Add solution to problem1.