Add solution to problem #38
add solution to problem #41