Infosys interview question

DSA and Algorithms - Medium and Hard