Apostek interview question

Mainly about data structures and algorithms