Infosys interview question

Just some basic coding questions