Update 0452.用最少数量的箭引爆气球.md

Java code:
- Fix an error in sorting (simplified as well)
- Add checking for boundary condition
This commit is contained in:
Yang
2021-05-31 16:43:45 -04:00
committed by GitHub
parent 5043002ed6
commit e5b81df01c

View File

@ -142,16 +142,8 @@ Java
```java
class Solution {
public int findMinArrowShots(int[][] points) {
Arrays.sort(points, new Comparator<int[]>() {
@Override
public int compare(int[] o1, int[] o2) {
if (o1[0] != o2[0]) {
return Integer.compare(o1[0],o2[0]);
} else {
return Integer.compare(o1[0],o2[0]);
}
}
});
if (points.length == 0) return 0;
Arrays.sort(points, (o1, o2) -> Integer.compare(o1[0], o2[0]));
int count = 1;
for (int i = 1; i < points.length; i++) {