Minimal Platforms

easy
1. You are given a number N representing number of trains.
2. You are given N space separated numbers representing (ArrT) arrival time of train.
3. You are given N space separated numbers representing (DepT) departure time of train.
4. A platform is needed everytime a train arrives.
5. Find the minimum number of platforms needed such that no train faces any problem while arrival/departure.

NOTE : All trains arrive & depart on the same day. 

Input Format

A number N(number of trains) ArrT1 ,ArrT2 ,ArrT3 ,ArrT4 ,ArrT5 .... ArrTn (arrival time of N trains) DepT1 ,DepT2 ,DepT3 ,DepT4 ,DepT5 .... DepTn (revenue time of N trains)

Output Format

Find the minimum number of platforms needed. Check the sample output and question video.

Constraints

1 <= N <= 1000
00:00 <= ArrT <= 24:00
ArrT < DepT <= 24:00

Example

Input
3
1049 2338 1629 
1759 2348 1729 
Output
2
Previous
Alternating Subsequence With Maximum Sum
Next
Minimum Deletions To Make Sorted Array

Related Questions