Skip to content

Commit b0000df

Browse files
iamAntimPalAntim-IWPIamShiwangi
committed
Update readme.md
Co-Authored-By: Antim-IWP <203163676+Antim-IWP@users.noreply.github.com> Co-Authored-By: Shiwangi Srivastava <174641070+IamShiwangi@users.noreply.github.com>
1 parent 47af6aa commit b0000df

File tree

1 file changed

+1
-38
lines changed
  • Solution/435. Non-overlapping Intervals

1 file changed

+1
-38
lines changed

Solution/435. Non-overlapping Intervals/readme.md

Lines changed: 1 addition & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
comments: true
33
difficulty: Medium
4-
edit_url: https://github.com/doocs/leetcode/edit/main/solution/0400-0499/0435.Non-overlapping%20Intervals/README_EN.md
4+
edit_url: Antim
55
tags:
66
- Greedy
77
- Array
@@ -13,8 +13,6 @@ tags:
1313

1414
# [435. Non-overlapping Intervals](https://leetcode.com/problems/non-overlapping-intervals)
1515

16-
[中文文档](/solution/0400-0499/0435.Non-overlapping%20Intervals/README.md)
17-
1816
## Description
1917

2018
<!-- description:start -->
@@ -136,41 +134,6 @@ public:
136134
};
137135
```
138136
139-
#### Go
140-
141-
```go
142-
func eraseOverlapIntervals(intervals [][]int) int {
143-
sort.Slice(intervals, func(i, j int) bool {
144-
return intervals[i][1] < intervals[j][1]
145-
})
146-
ans := len(intervals)
147-
pre := math.MinInt32
148-
for _, e := range intervals {
149-
l, r := e[0], e[1]
150-
if pre <= l {
151-
ans--
152-
pre = r
153-
}
154-
}
155-
return ans
156-
}
157-
```
158-
159-
#### TypeScript
160-
161-
```ts
162-
function eraseOverlapIntervals(intervals: number[][]): number {
163-
intervals.sort((a, b) => a[1] - b[1]);
164-
let [ans, pre] = [intervals.length, -Infinity];
165-
for (const [l, r] of intervals) {
166-
if (pre <= l) {
167-
--ans;
168-
pre = r;
169-
}
170-
}
171-
return ans;
172-
}
173-
```
174137
175138
<!-- tabs:end -->
176139

0 commit comments

Comments
 (0)