We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4ffdfa1 commit 85b5096Copy full SHA for 85b5096
solution/0452.Minimum Number of Arrows to Burst Balloons/Solution.java
@@ -0,0 +1,17 @@
1
+class Solution {
2
+ public int findMinArrowShots(int[][] points) {
3
+ if (points == null || points.length == 0) {
4
+ return 0;
5
+ }
6
+ Arrays.sort(points, Comparator.comparingInt(o -> o[1]));
7
+ int res = 1;
8
+ int pre = points[0][1];
9
+ for (int i = 1; i < points.length; ++i) {
10
+ if (points[i][0] > pre) {
11
+ ++res;
12
+ pre = points[i][1];
13
14
15
+ return res;
16
17
+}
0 commit comments