class Solution {
public int findMinArrowShots(int[][] points) {
if(points.length==0||points[0].length==0)
return 0;
Arrays.sort(points,(a,b)->a[1]-b[1]);
for(int i=0;i<points.length;i++){
System.out.println(Arrays.toString(points[i]));
}
int ans=0;
int min=points[0][1];
for(int i=1;i<points.length;i++){
if(points[i][0]>min){
ans++;
min=points[i][1];
}
}
return ans+1;
}
}
0 Comments