diff --git a/solution/452/main.go b/solution/452/main.go new file mode 100644 index 0000000..564074c --- /dev/null +++ b/solution/452/main.go @@ -0,0 +1,22 @@ +package main +func findMinArrowShots(points [][]int) int { + sort.Slice(points, func(i, j int) bool { + if points[i][1] == points[j][1] { + return points[i][0] < points[j][0] + } + return points[i][1] < points[j][1] + }) + + res := 1 + pos := points[0][1] + for _, point := range points { + if point[0] <= pos { + continue + } + + res++ + pos = point[1] + } + + return res +}