Added a solution to problem D