Standard Bar Greedy Approach · Medium O(n log n) · O(1)
A distribution hub logs delivery truck arrivals and departures on one operating day, all times in 24-hour codes. A dock frees up only strictly after a truck pulls out — a truck arriving at the exact moment another departs needs its own dock. The yard master wants the smallest dock count that keeps every truck moving without waiting.
Input: Two integer arrays: arr (arrival times) and dep (departure times), as HHMM codes.
Output: Return the minimum number of docks (platforms) required.
1 <= n <= 10^50 <= arr[i] <= dep[i] <= 2359A train (truck) arriving at time t cannot share a platform with one departing at tInput: {"arr":[900,940,950,1100,1500,1800],"dep":[910,1200,1120,1130,1900,2000]}
Output: 3
Around 1100, three trucks are simultaneously on-site (950, 1100 arrivals against the 1200 departure).
Input: {"arr":[900,1100,1235],"dep":[1000,1200,1240]}
Output: 1
Each truck departs before the next arrives, so one dock cycles through all three.