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.
Be the first one to answer
Add answer anonymously...
Top Oracle Software Engineer interview questions & answers
Popular interview questions of Software Engineer
Stay ahead in your career. Get AmbitionBox app
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+
Reviews
4 L+
Interviews
4 Cr+
Salaries
1 Cr+
Users/Month
Contribute to help millions
Get AmbitionBox app