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
}
相关推荐
6Hzlia7 小时前
【Hot 100 刷题计划】 LeetCode 199. 二叉树的右视图 | C++ DFS 逆序遍历
c++·leetcode·深度优先
踩坑记录9 小时前
leetcode hot100 118. 杨辉三角 easy 动态规划
leetcode·动态规划
cpp_25019 小时前
P1832 A+B Problem(再升级)
数据结构·c++·算法·动态规划·题解·洛谷·背包dp
geovindu10 小时前
go: Proxy Pattern
开发语言·后端·设计模式·golang·代理模式
木井巳10 小时前
【递归算法】解数独
java·算法·leetcode·决策树·深度优先·剪枝
上弦月-编程10 小时前
企业级RAG系统构建指南
leetcode
阿Y加油吧10 小时前
算法实战笔记:LeetCode 31 下一个排列 & 287 寻找重复数
笔记·算法·leetcode
穿条秋裤到处跑10 小时前
每日一道leetcode(2026.04.24):距离原点最远的点
算法·leetcode·职场和发展
踩坑记录10 小时前
121. 买卖股票的最佳时机 easy 贪心算法
leetcode
古城小栈10 小时前
hey 你好 “压测”
http·golang·开源