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
}
相关推荐
北冥you鱼35 分钟前
Go语言常用包使用指南:从标准库到第三方利器
开发语言·microsoft·golang
ttwuai2 小时前
Go 后台富文本图片上传失败排查:前端限制、接口和存储目录要一起看
前端·golang·状态模式
Wang's Blog3 小时前
Go-Zero基础入门1: 微服务框架与选型分析
开发语言·微服务·golang
伊玛目的门徒11 小时前
试用leetcode之典中典 二数之和问题
java·算法·leetcode
Kx_Triumphs15 小时前
HDU4348 To the moon(主席树区间修改模板)
算法·题解
旖-旎15 小时前
《LeetCode647 回文子串 || LeetCode 5 最长回文子串》
c++·算法·leetcode·动态规划·哈希算法
灯澜忆梦16 小时前
GO---可见性规则
开发语言·golang
怪兽学LLM18 小时前
LeetCode 105. 从前序与中序遍历序列构造二叉树:分治递归思路详解
算法·leetcode·职场和发展
退休倒计时19 小时前
【每日一题】LeetCode 39. 组合总和 TypeScript
算法·leetcode·typescript
Scabbards_19 小时前
面试Leetcode - Array
leetcode·面试·职场和发展