Solution for problem 24
Solution for problem 25