Added complete solution for problem 1