Pregunta de entrevista de Clear Street

Question based on designing an optimal Algorithm and questions around database design