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

题目:

题解:

Go 复制代码
func findMinArrowShots(points [][]int) int {
    if len(points) == 0 {
        return 0
    }
    sort.Slice(points, func(i, j int) bool { return points[i][1] < points[j][1] })
    maxRight := points[0][1]
    ans := 1
    for _, p := range points {
        if p[0] > maxRight {
            maxRight = p[1]
            ans++
        }
    }
    return ans
}
相关推荐
郝学胜-神的一滴12 小时前
Effective STL 条款 07:指针容器销毁前先删除
开发语言·c++·vscode·leetcode·rpc·visual studio
CoderYanger12 小时前
A.每日一题:2243. 计算字符串的数字和
java·开发语言·程序人生·leetcode·面试·蓝桥杯·学习方法
Navigator_Z15 小时前
LeetCode //C - 1323. Maximum 69 Number
c语言·算法·leetcode
利威尔xu17 小时前
2026-11-19-Go反射为什么慢面试
开发语言·面试·golang
关键词安全18 小时前
PHP / Node.js / Go / Rust 全部中招(CVE-2026-109618、109619、111497、111943)完整排查与修复清单
golang·rust·node.js
Pniubi2 天前
力扣2 . 两数相加
算法·leetcode·职场和发展
文丑颜不良啊2 天前
LeetCode3401~3420题目解析
java·leetcode
文丑颜不良啊2 天前
LeetCode3421~3440题目解析
java·leetcode
LK_073 天前
【力扣】142. 环形链表 II |Python
python·leetcode·链表
Pniubi3 天前
力扣21合并两个有序链表
算法·leetcode·职场和发展