Infosys interview question

Runtime analysis