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
}
相关推荐
WWW6526几秒前
代码随想录 打卡第四十七天
数据结构·算法·leetcode
cpp_25015 分钟前
P10722 [GESP202406 六级] 二叉树
数据结构·c++·算法·题解·洛谷·树形结构·gesp六级
smj2302_7968265211 分钟前
解决leetcode第3948题字典序最大的MEX数组
python·算法·leetcode
凌波粒1 小时前
LeetCode--530.二叉搜索树的最小绝对差(二叉树)
算法·leetcode·职场和发展
8Qi82 小时前
LeetCode 208:实现 Trie(前缀树)—— Java 题解 ✅
java·算法·leetcode·二叉树·tire树
罗超驿2 小时前
14.LeetCode 438 题解:滑动窗口+哈希表找所有字母异位词
java·算法·leetcode
小欣加油2 小时前
leetcode239 滑动窗口最大值
数据结构·c++·算法·leetcode·哈希算法
吃着火锅x唱着歌3 小时前
LeetCode 3829.设计共享出行系统
算法·leetcode·职场和发展
菜菜的顾清寒3 小时前
力扣HOT100(52)动态规划 - 最长递增子序列
算法·leetcode·动态规划
x_xbx3 小时前
LeetCode:20. 有效的括号
算法·leetcode·职场和发展