Morgan Stanley interview question

Data structures, time complexity