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
}
相关推荐
朔北之忘 Clancy6 小时前
2025 CSP-J 第二轮真题解析
c++·青少年编程·题解·noip·csp·信奥赛·noi
longlongzihan6 小时前
LeetCode 17电话号码的字母组合:回溯算法(DFS)详解
c++·算法·leetcode·深度优先
茉莉玫瑰花茶7 小时前
GO [ 方法 ]
开发语言·后端·golang
王老师青少年编程11 小时前
2026年9月GESP真题及题解(C++七级):括号序列
题解·真题·gesp·csp·c++七级·括号序列·2026年9月
smj2302_7968265212 小时前
解决leetcode第4064题至多一次取反能被k整除的最长子数组II
python·算法·leetcode
青山木12 小时前
Hot 100 --- 下一个排列
java·数据结构·算法·leetcode
垆边人似月.12 小时前
字符串重排后最大字典序
算法·leetcode·职场和发展
代码什么用13 小时前
LeetCode-42. 接雨水
算法·leetcode
茉莉玫瑰花茶14 小时前
GO [ 函数 ]
开发语言·后端·golang
茉莉玫瑰花茶14 小时前
GO [ 类型 ]
开发语言·数据库·golang