Remove Interval
Practice
3 (4 votes)
Algorithms
Binary search
Problem
28% Success 822 Attempts 30 Points 1s Time Limit 256MB Memory 1024 KB Max Code
Given \(N\) intervals of the form \([L,R]\) .
Removal cost of an interval is defined as the number of intervals with which it overlaps other than itself.
Among the removal cost of all given intervals, find the minimum possible removal cost.
Input Format:
- First line contain \(N\), denoting the number of intervals
- Next \(N\) lines contain two integers \(L \ \ R\) , denoting the interval.
Output Format:
Print an integer corresponding to minimum removal cost among \(N\) intervals.
Constraints
\(1 \le N \le 10^5 \\ 1 \le L \le R \le 10^5\)
Submissions
Please login to view your submissions
Similar Problems
Points:30
7 votes
Tags:
AlgorithmsBinary Search
Points:30
4 votes
Tags:
Binary SearchMedium
Points:30
8 votes
Tags:
Binary SearchAlgorithmsGreedy Algorithms
Editorial