Pregunta de entrevista de Bloomberg

Implement a data structure with sone condition.