Jane Street Interview Question

array problem about efficient scheduling