Solution for problem 11