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
相关推荐
飞猪~几秒前
Langchain python版本 LLM 重要函数invoke,ainvoke,stream,astream,batch,abatch
python·langchain·batch
沙蒿同学32 分钟前
当古诗词遇上 AI:从 38 万句诗词中取一个好名字
python·算法·架构
xxie1237941 小时前
Python装饰器与语法糖
开发语言·python
CClaris1 小时前
大模型量化从0到1(五):GPTQ 原理详解 + 从零量化一个真实大模型
人工智能·python·算法·机器学习
凯瑟琳.奥古斯特1 小时前
力扣1012数位DP解法详解
开发语言·c++·算法·leetcode·职场和发展
Railshiqian1 小时前
UserPickerActivity 内部逻辑分析
开发语言·python
一tiao咸鱼1 小时前
前端转 agent # 02 - FastAPI 框架入门与原理
前端·python
Yolo566Q2 小时前
Noah-MP陆面过程模型建模方法与站点、区域模拟实践技术应用
开发语言·python
肖永威3 小时前
麒麟 V10 编译 Python 3.11 依赖包缺失与版本冲突问题解决实录
运维·python·麒麟操作系统
Csvn3 小时前
Python 开发技巧 · 类型注解进阶 —— 从 `TypeVar` 到 `Protocol`,让类型检查真正帮你抓 bug
后端·python