Solution to Problem 4 (easy)