Add solution to Problem 1

This solution can be improved and made more Pythonic, but for now I'm
only interested in getting the correct answer.