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.

AnswerBot
4mo
The task is to 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 poin...read more
Help your peers!
Add answer anonymously...
TCS Associate Software Engineer interview questions & answers
An Associate Software Engineer was asked 2w agoQ. What is IPL in Mainframe?
An Associate Software Engineer was asked 2mo agoQ. What is abstraction?
An Associate Software Engineer was asked 2mo agoQ. What is inheritance?
Popular interview questions of Associate Software Engineer
An Associate Software Engineer was asked 2w agoQ1. What is IPL in Mainframe?
An Associate Software Engineer was asked 2mo agoQ2. What is abstraction?
An Associate Software Engineer was asked 2mo agoQ3. What is inheritance?
Stay ahead in your career. Get AmbitionBox app


Trusted by over 1.5 Crore job seekers to find their right fit company
80 L+
Reviews
10L+
Interviews
4 Cr+
Salaries
1.5 Cr+
Users
Contribute to help millions
AmbitionBox Awards
Get AmbitionBox app

