LTM Limited interview question

Dsa medium level question and dev also