Committing the solution to problem 1.