Adding solution and test for problem2