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
}
相关推荐
圣保罗的大教堂25 分钟前
leetcode 2996. 大于等于顺序前缀和的最小缺失整数 简单
leetcode
圣保罗的大教堂1 小时前
leetcode 3702. 按位异或非零的最长子序列 中等
leetcode
ylj_dev1 小时前
从 0 构建 AI Workload Platform(五):Agent Runtime、工具权限与自然语言工作流
golang·工作流·ai agent·大模型应用开发·agent runtime
青 春 记 忆2 小时前
LeetCode 206. 反转链表|Python 解法详解
python·leetcode·链表
灯澜忆梦4 小时前
【基于GO的Web开发9】gin框架返回json
前端·后端·golang·gin
青 春 记 忆4 小时前
LeetCode 226. 翻转二叉树|Python 解法详解
python·算法·leetcode
啊嘞嘞?5 小时前
力扣(回文链表)
算法·leetcode·链表
FfHUCisI6 小时前
Golang SSA 中间表示与优化 Pass
开发语言·后端·golang
wabs6666 小时前
关于栈【力扣150.逆波兰表达式求值的思考】
数据结构·c++·算法·leetcode··代码随想录