Minimum Number of Platforms Problem
Your task is to determine the minimum number of platforms required at a railway station so that no train has to wait.
Explanation:
Given two arrays:
AT
- representing the arrival times of trainsDT
- representing the departure times of trains.
Input:
The first line contains an integer 'T' indicating the number of test cases.
The first line of each test case has an integer 'N', the total number of trains.
The second line of each test case contains 'N' integers representing the array 'AT', which lists the arrival times of all trains.
The third line of each test case contains 'N' integers representing the array 'DT', which lists the departure times of all trains.
Output:
For each test case, return the minimum number of platforms needed such that no train has to wait.
Example:
Input:
T = 1
N = 3
AT = [900, 940, 950]
DT = [910, 1200, 1120]
Output:
2
Constraints:
- 1 <= T <= 10
- 1 <= N <= 50000
- 0 <= AT[i] <= DT[i] <= 2359
Note:
- Times are given in 24-hour format without colons. For example, 9:05 AM is represented as "905", and 9:10 PM is "2110".
- There are no leading zeros in time representations. For example, 12:10 AM would be represented as "10", not "0010".
- A train's departure time will always be greater than its arrival time.
Note:
You don't need to print anything; the function implementation will handle the output.
Be the first one to answer
Add answer anonymously...
Top SAP Software Developer Intern interview questions & answers
Popular interview questions of Software Developer Intern
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