Back to problems

Gate Entry / Exit Time Resolution with Tie-Break Rules

Algorithm · Google · Medium

Requirements Function: implement gate_times(requests), returning the output array described below. Input: a time-ordered array requests[i] = (timestamp, action), with i serving as the person's identifier and action ∈ {enter, exit}. Output: return an array of equal size such that result[i] gives the time at which person i actually passes through the gate. A single person may use the gate during each unit of time. When arrivals occur at the same timestamp, choose the order…

Checking your access…