Add solution to problem #21

Added solution to problem #21