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
相关推荐
长安er3 小时前
LeetCode215/347/295 堆相关理论与题目
java·数据结构·算法·leetcode·
元亓亓亓3 小时前
LeetCode热题100--62. 不同路径--中等
算法·leetcode·职场和发展
在屏幕前出油3 小时前
二、Python面向对象编程基础——理解self
开发语言·python
小白菜又菜3 小时前
Leetcode 1925. Count Square Sum Triples
算法·leetcode
阿方索3 小时前
python文件与数据格式化
开发语言·python
信创天地5 小时前
信创国产化数据库的厂商有哪些?分别用在哪个领域?
数据库·python·网络安全·系统架构·系统安全·运维开发
不哦罗密经5 小时前
python相关
服务器·前端·python
happybasic6 小时前
python字典中字段重复性的分析~~
开发语言·python
山海青风6 小时前
人工智能基础与应用 - 数据处理、建模与预测流程 6 模型训练
人工智能·python·机器学习
l木本I6 小时前
Reinforcement Learning for VLA(强化学习+VLA)
c++·人工智能·python·机器学习·机器人