← 返回 amazon 的题目列表Maximum Number of Running Processes
类型:online_judge
Problem: Maximum Number of Running Processes
Given n process running intervals intervals, where each interval is [start, end], meaning the process runs from start to end, return the maximum number of processes running at the same time.
This problem uses closed interval semantics:
If one process ends at time t and another process starts at time t, they are considered to be running simultaneously at time t.
Therefore, in a sweep line algorithm, start events at the same timestamp should be processed before end events.
Input Format
n
start_1 end_1
start_2 end_2
...
start_n end_n
Output Format
max_running_processes
Constraints
1 <= n <= 200000
-10^9 <= start_i <= end_i <= 10^9
Example
Input:
3
1 3
2 5
3 6
Output:
3
Example
Input
3
1 3
2 5
3 6
Output
3