8000 Add C# solutions · hellomrsun/Leetcode@58ca119 · GitHub
[go: up one dir, main page]

Skip to content

Commit 58ca119

Browse files
committed
Add C# solutions
1 parent 9f4e15c commit 58ca119

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
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+
}

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Click [here](https://leetcode.com/explore/challenge/card/october-leetcoding-chal
99
Solutions in various programming languages are provided. Enjoy it.
1010

1111
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)
1313

1414
## September LeetCoding Challenge
1515
Click [here](https://leetcode.com/explore/challenge/card/september-leetcoding-challenge) for problem descriptions.

0 commit comments

Comments
 (0)
0