Skip to content
CampusEduX

Minimum Platforms

Mediumjavapythonccppjavascript

Given the arrival and departure times of N trains at a station, find the minimum number of platforms needed so that no train waits. A platform is needed if a train arrives before or at the same moment another departs.

Input Format

The first line contains an integer N. The second line contains N space-separated integers — the arrival times. The third line contains N space-separated integers — the departure times.

Output Format

Print the minimum number of platforms required.

Related Problems

  • Activity Selection
    Medium · java, python, c, cpp, javascript
    Solve Problem
  • Fractional Knapsack
    Medium · java, python, c, cpp, javascript
    Solve Problem
  • Minimum Number of Coins
    Medium · java, python, c, cpp, javascript
    Solve Problem

Input (stdin)

Output

Run your code to see output here...