Add solution to 3rd problem