Infosys Interview Question

Runtime analysis