技术栈

Golang | Leetcode Golang题解之第452题用最少数量的箭引爆气球

__AtYou__2024-10-09 21:47

题目:

题解:

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
}
上一篇:.NET开源跨平台桌面和移动应用的统一框架 - Eto.Forms
下一篇:计算机硬件的工作原理
相关推荐
wenyq7
17 分钟前
LeetCode 2904. Shortest and Lexicographically Smallest Beautiful String
算法·leetcode
microrain
2 小时前
从关系库硬扛到专业时序引擎:SagooIoT时序数据存储的架构取舍
物联网·golang·开源·sagooiot
_Narcissus_
3 小时前
分治&递归
数据结构·c++·笔记·算法·leetcode·递归·分治
Vect__
4 小时前
channel 底层剖析
golang
青 春 记 忆
6 小时前
LeetCode 283. 移动零|Python 解法详解
python·算法·leetcode
李燚
7 小时前
数据库迁移不翻车:golang-migrate 实战,143 个 DDL 有序执行(第97篇-E83)
golang·agent·multiagent·migrate·eino·subagent·deepflux
evans在进步
9 小时前
LeetCode 189 轮转数组:三次反转为什么能实现右旋?
数据结构·算法·leetcode
运维开发笔记
9 小时前
7.1 Go Map 基础
golang
热门推荐
01国内可直接用、免费额度/永久免费的大模型API清单(含 SiliconFlow、火山、阿里、智谱、百度、Kimi、DeepSeek、DMXAPI 等)02GitHub 镜像站点03ZCode 周末送额度活动开启:3 亿 Token 免费领取04历年考研数学一、数学二、数学三真题试卷及答案PDF052026 国产 AI 大模型横评:DeepSeek、通义千问、Kimi、文心一言、星火、豆包谁更能打?06微信历史版本含下载地址( Windows PC | 安卓 | MAC )及设置微信不更新07AI 编程 IDE 全景解析 2026:Agent 全面接管开发链路08Agnes AI 免费 API 接入指南:文本、生图、生视频,一套接口全免费09蜘蛛磁力 搜索引擎大全,如何使用蜘蛛磁力查找磁力链接10VSCode+CodeX扩展,无法启动