Solution to Problem 1 (Difficult)