Problem 7 of Arrays with Custom Solution