Solution to Array Hopper Problem