```
public class Solution {
public int findMinArrowShots(int[][] points) {
if (points == null || points.length == 0) return 0;
Arrays.sort(points, new Comparator<int[]>(){
public int compare(int[] p, int[] q) {
return p[0] == q[0] ? p[1] - q[1] : p[0] - q[0];
}
});
int res = 1;
int minEnd = points[0][1];
for (int[] pair : points) {
if (pair[0] > minEnd) {
minEnd = pair[1];
res++;
}
else minEnd = Math.min(minEnd, pair[1]);
}
return res;
}
}
```