Asked inNutanix,Mts1

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 trains
  • DT - 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.
AnswerBot
4mo

Determine the minimum number of platforms needed at a railway station so that no train has to wait.

  • Sort the arrival and departure times arrays in ascending order.

  • Initialize two pointers for arrival an...read more

Help your peers!
Select
Add answer anonymously...

Nutanix Mts1 interview questions & answers

A Mts1 was asked Q. Ninja and Stack of Boxes Problem Help Ninja to create the tallest stack possible...read more
A Mts1 was asked Q. Split the String Problem Statement You are given a string str consisting of N lo...read more
A Mts1 was asked Q. Lexicographic Permutation Rank Problem Statement Given a distinct string, determ...read more

Popular interview questions of Mts1

A Mts1 was asked Q1. Ninja and Stack of Boxes Problem Help Ninja to create the tallest stack possible...read more
A Mts1 was asked Q2. Split the String Problem Statement You are given a string str consisting of N lo...read more
A Mts1 was asked Q3. Lexicographic Permutation Rank Problem Statement Given a distinct string, determ...read more
Nutanix Mts1 Interview Questions
Stay ahead in your career. Get AmbitionBox app
play-icon
play-icon
qr-code
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

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2025 Info Edge (India) Ltd.

Follow Us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter
Profile Image
Hello, Guest
AmbitionBox Employee Choice Awards 2025
Winners announced!
awards-icon
Contribute to help millions!
Write a review
Write a review
Share interview
Share interview
Contribute salary
Contribute salary
Add office photos
Add office photos
Add office benefits
Add office benefits