dsa · medium
Minimum Platforms
GreyOrangeGreedySortingHeap
arr arrival times, dep departure times (minutes from midnight). Return the minimum platforms so no two trains share a platform at the same time. A departure at t frees the platform for an arrival at t (touching is OK).
Arguments
arr— the input arraydep— departure times, parallel to arrivals
**Example**
`` Input: [900,940,950,1100,1500,1800] [910,1200,1120,1130,1900,2000] Output: 3 ``
Constraints
1 <= n <= 1000 Hidden tests include near-max size for this bound; a slower-than-intended solution TLEs.
Examples
Example 1
Input: [900,940,950,1100,1500,1800] [910,1200,1120,1130,1900,2000] Expected: 3