Jane Street interview question

array problem about efficient scheduling