staff employees numbered 0 to staff - 1. They worked through tasks one after another with no breaks: the first task started at time 0, and each next task started the moment the previous one ended.
You are given a list records where records[i] = [who, end]: task i was done by employee who and finished at time end. Finish times are strictly increasing, and no employee takes two tasks in a row.
Return the id of the employee who spent the most time on a single task. If several tasks share the longest time, return the smallest id among the people who did them.staff=4, records=[[2, 4], [0, 6], [3, 13], [1, 15]] → 3
The tasks took 4, 2, 7 and 2 time units. The longest is the third one (from 6 to 13), done by employee 3.
staff=5, records=[[4, 5], [1, 10], [4, 12]] → 1
The first two tasks took 5 each, done by employees 4 and 1, so we return the smaller id, 1.
end values are strictly increasingstaff=4, records=[[2, 4], [0, 6], [3, 13], [1, 15]]
3
Run checks the first 3 tests in your browser. Submit checks all 94 tests on the server, hidden ones included.