Infosys interview question

the puzzles