Infosys interview question

Leet code medium type questions