Problem 7 - slow

Slow version of problem 7 that could potentially be refactored.