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
}
相关推荐
JWASX1 小时前
Java 转 go 学习 - 并发编程(2)
学习·golang
All for pursuit.2 小时前
【回溯-6】79.单词搜索
数据结构·c++·算法·leetcode
Navigator_Z2 小时前
LeetCode //C - 1281. Subtract the Product and Sum of Digits of an Integer
c语言·算法·leetcode
ttwuai3 小时前
Go开源后台管理系统推荐:README、源码和License应该怎么验
开发语言·golang·开源
JWASX3 小时前
Java 转 go 学习 - 并发编程(1)
学习·golang
旖旎夜光4 小时前
LeetCode 1576: 替换所有的问号(模拟) —— 题解
c++·学习·算法·leetcode·力控
longlongzihan4 小时前
回溯法详解:LeetCode 46. 全排列
算法·leetcode·回溯
JWASX5 小时前
Java 转 go 学习 - 接口
学习·golang
小小龙学IT5 小时前
Go 语言 reflect 反射包深度解析:从 Type/Value 到三大定律与工业实践
前端·golang
JWASX5 小时前
Java 转 go 学习 - 并发编程(3)
学习·golang