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
相关推荐
微小冷13 小时前
Python图论库NetworkX初步
开发语言·python·图论·graph·networkx·digraph
Data_Journal14 小时前
如何使用 Python 抓取 Google Flights:分步指南
大数据·开发语言·数据库·python·scrapy
Nil20814 小时前
leetcode 105从前序和中序遍历序列构造二叉树
算法·leetcode·职场和发展
你我一见如故14 小时前
仿QQ音乐桌面客户端——测试报告
python·selenium
Kismet_nvi15 小时前
Python 基础核心知识点总结
开发语言·windows·python
2401_8445829515 小时前
冷门技巧:AI模型可靠性测试的实用技巧:数
python
you鬰15 小时前
datawhale--llm-algo-leetcode5️⃣
python·datawhale
λqaq715 小时前
MySQL 数据库基础(2)约束、用户权限、远程连接、外键与 TCP/UDP 理解
linux·数据库·python·tcp/ip·mysql
人工干智能15 小时前
科普:pandas 时间偏移别名:ts.resample(“5Min“).sum()
python·pandas
Nil20815 小时前
leetcode 114二叉树展开为链表
leetcode·链表·深度优先