Problem 35 Solution. ~6 Seconds Execution Time