Pregunta de entrevista de Morgan Stanley

Which data structure is best to implement this?