Recall & Review
beginner
What is the problem statement of the Minimum Number of Platforms?
Given arrival and departure times of trains, find the minimum number of platforms required so that no train waits.
Click to reveal answer
beginner
Why do we sort arrival and departure times separately in the Minimum Number of Platforms problem?
Sorting helps to process events in chronological order, making it easier to track how many trains are at the station at the same time.
Click to reveal answer
beginner
What does the variable 'platforms_needed' represent during the algorithm?
'platforms_needed' tracks the current number of trains at the station, indicating how many platforms are occupied at that moment.
Click to reveal answer
beginner
How do we update the count of platforms when a train arrives or departs?
When a train arrives, increment 'platforms_needed'. When a train departs, decrement 'platforms_needed'.
Click to reveal answer
beginner
What is the final answer in the Minimum Number of Platforms problem?
The maximum value of 'platforms_needed' during the process is the minimum number of platforms required.
Click to reveal answer
Why do we need to sort arrival and departure times separately?
✗ Incorrect
Sorting arrival and departure times separately allows us to process train events in order of time.
What does an increase in 'platforms_needed' signify?
✗ Incorrect
When a train arrives, 'platforms_needed' increases because one more platform is occupied.
If arrival[i] > departure[j], what should we do in the algorithm?
✗ Incorrect
If a train departs before the next arrives, we free a platform by decrementing 'platforms_needed'.
What is the time complexity of the Minimum Number of Platforms algorithm after sorting?
✗ Incorrect
Sorting takes O(n log n), and the traversal is O(n), so overall O(n log n).
What does the maximum value of 'platforms_needed' represent?
✗ Incorrect
The maximum 'platforms_needed' is the minimum number of platforms needed to avoid waiting.
Explain the step-by-step approach to find the minimum number of platforms needed for trains.
Think about processing train events in order of time.
You got /6 concepts.
Why is sorting both arrival and departure times separately important in this problem?
Consider how to know when a platform frees up before next train arrives.
You got /3 concepts.