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
相关推荐
Cloud_Shy61815 小时前
解读《Effective Python 3rd Edition》:从练气到老魔
开发语言·python
SunnyDays101115 小时前
Python 操作 Excel 超链接:添加网页、文件、工作表和图片链接
python·excel
li星野15 小时前
RAG优化系列:HyDE(假设文档嵌入)——让LLM先写答案再检索
python·学习
知识分享小能手15 小时前
Flask入门学习教程,从入门到精通,Flask智能租房——用户中心知识点详解(9)
python·学习·flask
MageGojo15 小时前
做节日活动页时,如何用 API 快速生成对联内容
javascript·python·节日·对联生成
l1t15 小时前
DeepSeek总结的使用实体-组件-系统和基于存在性处理进行Python编程15-17
开发语言·数据库·python
河阿里15 小时前
Python数据可视化:Matplotlib从入门到精通
python·信息可视化·matplotlib
麻雀飞吧16 小时前
2026年期货量化入门路径:主流平台学习曲线与卡点观察
python
TechWayfarer16 小时前
IP数据接口调用示例:社交软件如何做同城匹配与用户画像分析
python·网络协议·tcp/ip·社交电子