LTIMindtree interview question

asked to write the code asked the basic questions data structures