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
}
相关推荐
203号居民3 分钟前
LeetCode hot 100 — 138. 随机链表的复制
算法·leetcode·链表
Johnston_man15 分钟前
golang 安装 protoc、protoc-gen-go、protoc-gen-go-grpc、protoc-gen-grpc-gateway
后端·golang
ttwuai19 分钟前
Go 后台接入单点登录后,JWT、菜单权限和接口 403 怎么验?
开发语言·后端·golang
土司大王1 小时前
LeetCode hot100——实现 Trie (前缀树)
java·算法·leetcode
麻瓜code2 小时前
【LeetCode】相交链表:双指针法,一次遍历找到交点
算法·leetcode·链表
hanlin033 小时前
刷题笔记:力扣第84题-柱状图中最大的矩形
笔记·算法·leetcode
辰烨chenye8 小时前
LeetCode Hot 100 题解 · 普通数组篇
算法·leetcode·职场和发展
辰烨chenye12 小时前
LeetCode Hot 100 题解 · 二分篇
java·算法·leetcode
码士集团小青15 小时前
从对标 Java 到对标 Go:Native AOT 的“无痛化“之路,走到哪一站了?
golang
右耳朵猫AI16 小时前
Go周刊2026W36 | Go 1.27.1 发布、TinyGo 0.42、HTTP/2 原生迁入 net/http、quic-go 0.62
redis·http·golang