Add solution to problem #22

Added solution to problem #22