0
点赞
收藏
分享

微信扫一扫

ORACLE归档日志满,没法访问

LeetCode452. 用最少数量的箭引爆气球

题目链接

https://leetcode.cn/problems/minimum-number-of-arrows-to-burst-balloons/description/
在这里插入图片描述

代码

class Solution:
    def findMinArrowShots(self, points: List[List[int]]) -> int:
        if len(points) == 0:
            return 0
        points.sort(key=lambda x: x[0])
        result = 1
        for i in range(1, len(points)):
            if points[i - 1][1] < points[i][0]:
                result += 1
            else:
                points[i][1] = min(points[i][1], points[i - 1][1])
        return result
举报

相关推荐

0 条评论