File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed
October-LeetCoding-Challenge/04-Remove-Covered-Intervals Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change
1
+ public class Solution {
2
+ public int RemoveCoveredIntervals ( int [ ] [ ] intervals ) {
3
+ Array . Sort ( intervals , ( x , y ) => x [ 0 ] == y [ 0 ] ? y [ 1 ] - x [ 1 ] : x [ 0 ] - y [ 0 ] ) ;
4
+ int count = 0 ;
5
+ int curr = 0 ;
6
+ foreach ( int [ ] interval in intervals ) {
7
+ if ( curr < interval [ 1 ] ) {
8
+ curr = interval [ 1 ] ;
9
+ count ++ ;
10
+ }
11
+ }
12
+ return count ;
13
+ }
14
+ }
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ Click [here](https://leetcode.com/explore/challenge/card/october-leetcoding-chal
9
9
Solutions in various programming languages are provided. Enjoy it.
10
10
11
11
1 . [ Number of Recent Calls] ( https://github.com/AlgoStudyGroup/Leetcode/tree/master/October-LeetCoding-Challenge/01-Number-of-Recent-Calls ) : Queue
12
-
12
+ 4 . [ Remove Covered Intervals ] ( https://github.com/AlgoStudyGroup/Leetcode/tree/master/October-LeetCoding-Challenge/04-Remove-Covered-Intervals )
13
13
14
14
## September LeetCoding Challenge
15
15
Click [ here] ( https://leetcode.com/explore/challenge/card/september-leetcoding-challenge ) for problem descriptions.
You can’t perform that action at this time.
0 commit comments