problem 1.2 passing all test cases