[LeetCode] Time Taken to Cross the Door

1 · · Jan. 30, 2023, noon
2534. Time Taken to Cross the Door There are n persons numbered from 0 to n - 1 and a door. Each person can enter or exit through the door once, taking one second. You are given a non-decreasing integer array arrival of size n, where arrival[i] is the arrival time of the ith person at the door. You are also given an array state of size n, where state[i] is 0 if person i wants to enter through the door or 1 if they want to exit through the door. If two or more persons want to use the door at the...