first puzzle.  Not optimal but better than O(n)