0452.Minimum Number of Arrows to Burst Balloons
class Solution {
public int findMinArrowShots(int[][] points) {
int count = 1;
int n = points.length;
Arrays.sort(points, (a, b) -> Integer.compare(a[0], b[0]));
int end = points[0][1];
for(int i = 1; i < n; i++) {
if(end >= points[i][0]) {
end = Math.min(end, points[i][1]);
} else {
count++;
end = points[i][1];
}
}
return count;
}
}