Completes problem 2.
Merge pull request #1 from anthonyyim/problem2

Completes problem 2.