#K95937. Maximum Concurrent Sessions
Maximum Concurrent Sessions
Maximum Concurrent Sessions
You are given a list of sessions where each session has a start time and an end time. Determine the maximum number of sessions that are active concurrently. In other words, find the maximum number of sessions that overlap at some point in time. Formally, if each session is represented as a pair ((s, e)) with start time (s) and end time (e), your task is to compute the maximum number of sessions that are ongoing at the same time using the formula: [ \text{maxConcurrent} = \max_{t}{#{(s, e) : s \le t < e}} ] Note that if a session ends at the same time another session starts, they are not considered overlapping.
inputFormat
The input is read from stdin. The first line contains an integer (N) representing the number of sessions. Each of the next (N) lines contains two space-separated integers (s) and (e), representing the start and end times of a session.
outputFormat
Output a single integer to stdout: the maximum number of concurrent sessions.## sample
3
1 3
2 5
4 6
2