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
}
相关推荐
码农大叔的博客14 分钟前
golang示例:switch
开发语言·后端·golang
青 春 记 忆1 小时前
LeetCode 121. 买卖股票的最佳时机|Python 解法详解
python·算法·leetcode
圣殿骑士-Khtangc3 小时前
Go面试核心考点之GMP调度器源码级深度解析
golang
Navigator_Z3 小时前
LeetCode //C - 1203. Sort Items by Groups Respecting Dependencies
c语言·算法·leetcode
Scabbards_17 小时前
面试Leetcode - Heap 堆
java·leetcode·面试
ValhallaCoder20 小时前
Leetcode-hot100(2026.08.17)
python·算法·leetcode
xcLeigh20 小时前
Go入门:无类型常量与类型常量的区别
服务器·开发语言·golang
泡沫冰@20 小时前
GO 语言基础
开发语言·算法·golang
青 春 记 忆1 天前
LeetCode 104. 二叉树的最大深度|Python 解法详解
python·算法·leetcode
骇客野人1 天前
电商商城微服务架构设计方案(SpringCloud/Go+Vue3+MySQL+ES+RocketMQ)
spring cloud·微服务·golang