```
public int findMinArrowShots(int[][] points) {
if(points == null || points.length == 0 || points[0].length == 0){
return 0;
}
int total = points.length;
Arrays.sort(points, new Comparator<int[]>(){
//sort points based on the left position
@Override
public int compare(int[] a, int[] b){
return a[0] - b[0];
}
});
int cur = 0;
for(int i = 1; i<points.length; i++){
if(points[cur][1] < points[i][0]){
cur = i;
continue;
}
else{
// overlap, then find the overlapped right end.
points[cur][1] = Math.min(points[cur][1], points[i][1]);
total--;// one more overlap means one less arrow required
}
}
return total;
}
```