Morgan Stanley interview question

Which data structure is best to implement this?