
Minimum Number of Platforms Needed Problem Statement
You are given the arrival and departure times of N trains at a railway station for a particular day. Your task is to determine the minimum number of platforms required so that no train has to wait, meaning that every arriving train has an available platform immediately.
Input:
The input begins with a single integer T, representing the number of test cases. Each test case consists of:
- A line with a positive integer N, the number of trains.
- A line containing N integers, the arrival times of the trains in HHMM format.
- A line containing N integers, the departure times of the trains in HHMM format.
Output:
For each test case, return the minimum number of platforms needed at the railway station.
Example:
Input:
T = 1
N = 3
Arrivals = [900, 940, 950]
Departures = [910, 1200, 1120]
Output:
2
Explanation:
In the given example, between 940 and 950, you have two overlapping schedules which require two platforms.
Constraints:
1 <= T <= 100
1 <= N <= 1000
0 <= arrival[i] <= departure[i] <= 2359
- Time representation is in HHMM format.
Note:
Do not print anything. It has been already taken care of.


Determine the minimum number of platforms needed at a railway station based on arrival and departure times of trains.
Sort the arrival and departure times in ascending order.
Use two pointers to keep tr...read more





Space Complexity: O(1)Explanation: Time Complexity: O(1)Explanation:

Space complexity:o(1) Explanation:Ti me complexity:o(1) Explanation:
Top Amazon Software Developer interview questions & answers
Popular interview questions of Software Developer
Top HR questions asked in Amazon Software Developer
Reviews
Interviews
Salaries
Users/Month