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
}
相关推荐
念何架构之路8 小时前
go-grpc设计思想
开发语言·后端·golang
microrain9 小时前
SagooIoT 的缓存换后端只改一行配置,文件后端连 Redis 都不需要
物联网·缓存·golang·sagooiot
y1su11 小时前
Leetcode 字符串模板
java·数据结构·算法·leetcode·职场和发展·动态规划
喵了几个咪11 小时前
GoWind ShortPlay 深度拆解:三服务 BFF + Core,一条请求的完整工程链路
golang·gowind
lvwangshu14 小时前
P8981 「DROI」Round 1 距离 题解
动态规划·图论·题解·dp·树形dp·技巧·换根dp·性质题·思维好题
Xin77017 小时前
LeetCode 46. 全排列(回溯法)
leetcode
文丑颜不良啊19 小时前
LeetCode476~500题目解析
java·leetcode
Tsuki_tl20 小时前
【优选算法:双指针】——复写零题解
java·c++·算法·leetcode·数组·双指针·复写零
Cccp.1231 天前
【leetcode】(十四)从暴力递归到动态规划
数据结构·算法·leetcode·动态规划
旖旎夜光1 天前
LeetCode 215: 数组中的第K个最大元素 (快速排序) —— 题解
c++·学习·算法·leetcode·力控