Add solution to problem #41

Addd solution to problem #41