Infosys interview question

Algorithms, Programming