added solutions and tests for problem 2.