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
}
相关推荐
叶小鸡4 小时前
小鸡玩算法-力扣HOT100-动态规划(下)
算法·leetcode·动态规划
毅炼7 小时前
今日LeetCode 摸鱼打卡
java·算法·leetcode
m0_629494737 小时前
LeetCode 热题 100-----28. 两数相加
数据结构·算法·leetcode·链表
菜菜的顾清寒7 小时前
力扣HOT100(25)环形链表
算法·leetcode·链表
jieyucx9 小时前
从基础语法到面向对象:Go语言如何实现封装、继承与多态?
开发语言·后端·golang
littleschemer10 小时前
Go:实现游戏服务器网关
服务器·网关·游戏·golang
Controller-Inversion11 小时前
76. 最小覆盖子串
java·算法·leetcode
_日拱一卒11 小时前
LeetCode:437路径总和Ⅲ
算法·leetcode·职场和发展
世纪末的小黑11 小时前
【LeetCode自用】LeetCode自用记录贴,题目一:两数之和
数据结构·算法·leetcode
兰令水11 小时前
topcode【随机算法题】【2026.5.22打卡-java版本】
java·算法·leetcode