Compute earliest arrival in time-grid | DoorDash Interview Question