Add solution to problem #23

Added solution to problem #23