public class Solution {

public int findMinArrowShots(int[][] points) {

if (points == null || points.length == 0) return 0;

```
int count = 0;
Arrays.sort(points, new myComparator());
for (int i = 1; i < points.length; i++) {
if (points[i-1][1] >= points[i][0]) {
points[i][0] = Math.max(points[i][0], points[i-1][0]);
points[i][1] = Math.min(points[i][1], points[i-1][1]);
count++;
}
}
return points.length - count;
}
```

}

class myComparator implements Comparator<int[]> {

public int compare(int[] a, int[] b) {

if(a[0]==b[0]) return a[1]-b[1];

else return a[0]-b[0];

}

}