auto commit

This commit is contained in:
CyC2018 2020-11-01 15:58:29 +08:00
parent 3637b789d9
commit 7b755d9910
2 changed files with 12 additions and 8 deletions

View File

@ -106,13 +106,15 @@ public int eraseOverlapIntervals(int[][] intervals) {
```java
Arrays.sort(intervals, new Comparator<int[]>() {
@Override
public int compare(int[] o1, int[] o2) {
return o1[1] - o2[1];
}
@Override
public int compare(int[] o1, int[] o2) {
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)

View File

@ -106,13 +106,15 @@ public int eraseOverlapIntervals(int[][] intervals) {
```java
Arrays.sort(intervals, new Comparator<int[]>() {
@Override
public int compare(int[] o1, int[] o2) {
return o1[1] - o2[1];
}
@Override
public int compare(int[] o1, int[] o2) {
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)