Added the solution for the first problem.