GlobalLogic interview question

Puzzles