Quantiphi interview question

Data structures and Time complexity