Coded a solution to Problem 3 that should work but doesn't.