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...
Oracle Software Engineer interview questions & answers
A Software Engineer was asked 6mo agoQ. Given an integer array, find the length of the longest subarray that contains al...read more
A Software Engineer was asked 7mo agoQ. Given a vector of numbers, return the index of the vector which has the longest ...read more
A Software Engineer was asked Q. How would you convert a number to its English word representation?
Popular interview questions of Software Engineer
A Software Engineer was asked 6mo agoQ1. Given an integer array, find the length of the longest subarray that contains al...read more
A Software Engineer was asked 7mo agoQ2. Given a vector of numbers, return the index of the vector which has the longest ...read more
A Software Engineer was asked Q3. Given an array, remove the duplicate elements from the array.
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

