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
}
相关推荐
文丑颜不良啊3 分钟前
LeetCode1581~1600题目解析
java·leetcode
文丑颜不良啊3 小时前
LeetCode1541~1560题目解析
java·leetcode
念何架构之路3 小时前
Go 标准库 database/sql 详解
数据库·sql·golang
modelmd4 小时前
Go 切片、映射常见使用场景
开发语言·后端·golang
漂流瓶jz13 小时前
UVA-1612 猜名次 题解答案代码 算法竞赛入门经典第二版
数据结构·算法·题解·排序·aoapc·算法竞赛入门经典
文丑颜不良啊13 小时前
LeetCode1481~1500题目解析
java·leetcode
文丑颜不良啊14 小时前
LeetCode1381~1400题目解析
java·leetcode
超级架构师16 小时前
PRAXO-CORE 2.5.0:用 conformance 和显式边界构建 Go Agent 框架
开发语言·人工智能·后端·golang·ai编程·智能体框架·praxo-core
Tisfy18 小时前
LeetCode 3882.网格图中最小异或路径:动态规划
算法·leetcode·动态规划
A boy CDEF girl19 小时前
算法题专栏:优选算法
数据结构·算法·leetcode