auto commit
This commit is contained in:
parent
3637b789d9
commit
7b755d9910
|
@ -108,11 +108,13 @@ public int eraseOverlapIntervals(int[][] intervals) {
|
|||
Arrays.sort(intervals, new Comparator<int[]>() {
|
||||
@Override
|
||||
public int compare(int[] o1, int[] o2) {
|
||||
return o1[1] - o2[1];
|
||||
return (o1[1] < o2[1]) ? -1 : ((o1[1] == o2[1]) ? 0 : 1);
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
实现 compare() 函数时避免使用 `return o1[1] - o2[1];` 这种减法操作,防止溢出。
|
||||
|
||||
# 3. 投飞镖刺破气球
|
||||
|
||||
452\. Minimum Number of Arrows to Burst Balloons (Medium)
|
||||
|
|
|
@ -108,11 +108,13 @@ public int eraseOverlapIntervals(int[][] intervals) {
|
|||
Arrays.sort(intervals, new Comparator<int[]>() {
|
||||
@Override
|
||||
public int compare(int[] o1, int[] o2) {
|
||||
return o1[1] - o2[1];
|
||||
return (o1[1] < o2[1]) ? -1 : ((o1[1] == o2[1]) ? 0 : 1);
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
实现 compare() 函数时避免使用 `return o1[1] - o2[1];` 这种减法操作,防止溢出。
|
||||
|
||||
# 3. 投飞镖刺破气球
|
||||
|
||||
452\. Minimum Number of Arrows to Burst Balloons (Medium)
|
||||
|
|
Loading…
Reference in New Issue
Block a user