← 返回 amazon 的题目列表Detect Overlapping Time Intervals
类型:online_judge
Given n task time intervals, determine whether any two tasks overlap.
Each interval is represented as [start, end], where start < end. If one task starts exactly when another task ends, such as [1, 3] and [3, 5], they do not overlap.
Output true if there is an overlap; otherwise, output false.
Input Format
First line: integer n
Next n lines: two integers, start end
Output Format
Print true or false.
Example 1
Input:
3
0 30
5 10
15 20
Output:
true
Example 2
Input:
2
7 10
2 4
Output:
false
Constraints
0 <= n <= 2 * 10^5
-10^9 <= start < end <= 10^9
Example
Input
3
0 30
5 10
15 20
Output
true