Python | Leetcode Python题解之第452题用最少数量的箭引爆气球

题目:

题解:

python 复制代码
class Solution:
    def findMinArrowShots(self, points: List[List[int]]) -> int:
        if not points:
            return 0
        
        points.sort(key=lambda balloon: balloon[1])
        pos = points[0][1]
        ans = 1
        for balloon in points:
            if balloon[0] > pos:
                pos = balloon[1]
                ans += 1
        
        return ans
相关推荐
Pluchon几秒前
硅基计划4.0 算法 二叉树深搜(DFS)
java·数据结构·算法·leetcode·深度优先·剪枝
StarPrayers.10 分钟前
用 PyTorch 搭建 CIFAR10 线性分类器:从数据加载到模型推理全流程解析
人工智能·pytorch·python
程序员杰哥12 分钟前
UI自动化测试实战:从入门到精通
自动化测试·软件测试·python·selenium·测试工具·ui·职场和发展
SunnyRivers14 分钟前
通俗易懂理解python yield
python
mortimer15 分钟前
Python 进阶:彻底理解类属性、类方法与静态方法
后端·python
sprintzer1 小时前
10.6-10.15力扣模拟刷题
算法·leetcode·职场和发展
小叮当⇔2 小时前
PYcharm——获取天气
ide·python·pycharm
一匹电信狗2 小时前
【C++】C++风格的类型转换
服务器·开发语言·c++·leetcode·小程序·stl·visual studio
霍志杰2 小时前
记一次csv和xlsx之间的转换处理
python
测试19982 小时前
Jmeter是如何实现接口关联的?
自动化测试·软件测试·python·测试工具·jmeter·职场和发展·接口测试