Pregunta de entrevista de Jane Street

array problem about efficient scheduling