Add solution for problem 3 and test