Infosys interview question

Dta structure and algorithms question