hackerrank contest week 12 : Chief Hopper