ION Group interview question

The first question was based on Puzzle