Pregunta de entrevista de Noom

write a data structure for this hypothetical functionality