Infosys interview question

general puzzles and basic codes