Pregunta de entrevista de Point72

Solve a greedy algorithm coding question.