Pregunta de entrevista de Susquehanna International Group

Coding question on data structure