Leetcode 452 Solution

This article provides solution to leetcode question 452 (minimum-number-of-arrows-to-burst-balloons)

https://leetcode.com/problems/minimum-number-of-arrows-to-burst-balloons

Solution

class Solution:
    def findMinArrowShots(self, points: List[List[int]]) -> int:
        points.sort(key=lambda x: (x[1], x[0]))

        cnt = 1
        curr_end = points[0][1]

        for begin, end in points:
            if begin > curr_end:
                cnt += 1
                curr_end = end

        return cnt