Pregunta de entrevista de HBO

Design and algorithm questions.