#K5046. Minimum Number of Platforms Required

    ID: 28869 Type: Default 1000ms 256MiB

Minimum Number of Platforms Required

Minimum Number of Platforms Required

You are given a schedule of trains represented by their arrival and departure times in HH:MM format. Your task is to determine the minimum number of platforms required at the railway station so that no train has to wait.

If a train arrives before another departs, an additional platform is needed. Use efficient sorting and comparison techniques. The answer is determined by sorting the arrival and departure times and then tracking the maximum number of trains present at any time.

The formula to track platforms is:

\(platforms = max\{platforms, current\_platforms\}\)

inputFormat

The first line contains an integer T, the number of trains. Each of the following T lines contains two strings representing the arrival and departure times in HH:MM format, separated by a space.

outputFormat

Print a single integer representing the minimum number of platforms required.## sample

6
09:00 09:10
09:40 12:00
09:50 11:20
11:00 11:30
15:00 19:00
18:00 19:30
3

</p>