Minimum Number of Platform Needed
You are given the arrival and departure times of N trains at a railway station in a day. You need to find the minimum of platforms required for the railway station such that no train waits i.e No train should wait for the platform to be clear or free.
Input Format :
The first line of input contains a single integer T, representing the number of test cases or queries to be run.
Then the T test cases follow.
The first line of each test case contains a positive integer N which represents the number of trains that arrive at the railway station in a day.
The Second line of each test case contains N integers denoting the arrival time of all the trains.
The third line of each test case contains N integers denoting the departure time of all the trains.
Output Format :
For each test case, return the minimum number of platforms required at the railway station such that no train waits.
Note :
Representation of arrival and departure time will be in HHMM format.
Do not print anything. It has been already taken care of.
Constraints :
1 <= T <=100
1 <= N <=1000
0 <= arrival[i] <= departure[i] <= 2359
Time Limit: 1 sec
CodingNinjas
author
2y
Space Complexity: O(1)Explanation: Time Complexity: O(1)Explanation:
CodingNinjas
author
2y
Space Complexity: O(1)Explanation: Time Complexity: O(1)Explanation:
Help your peers!
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