当前位置:网站首页>Leetcode 452. minimum number of arrows to burst balloons (medium)
Leetcode 452. minimum number of arrows to burst balloons (medium)
2022-07-28 00:21:00 【InfoQ】
One 、 The main idea of the topic
- stay x = 2 Shoot an arrow , Break the balloon [1,2] and [2,3].
- stay x = 4 Shoot an arrow at , Break the balloon [3,4] and [4,5].
- 1 <= points.length <= 105
- points[i].length == 2
- -231 <= xstart < xend <= 231 - 1
Two 、 Their thinking
3、 ... and 、 How to solve the problem
3.1 Java Realization
public class Solution {
public int findMinArrowShots(int[][] points) {
// Sorting two-dimensional arrays ??
Arrays.sort(points, Comparator.comparingInt(o -> o[1]));
int res = 1;
int end = points[0][1];
for (int i = 1; i < points.length; i++) {
if (points[i][0] <= end) {
end = Math.min(end, points[i][1]);
} else {
res++;
end = points[i][1];
}
}
return res;
}
}
Four 、 Summary notes
- 2022/7/27 Resume one question per day
边栏推荐
- Cache and MMU management
- [极客大挑战 2019]RCE ME
- How Flink uses savepoint
- R语言R原生plot函数和lines函数的主要参数说明、解析(type、pch、cex、lty、lwd、col、xlab、ylab)
- require、loadfile、dofile、load、loadstring
- 传奇服务端:GOM GeeM2引擎更新时必须要修改哪些地方?
- Introduction to thesis writing | how to write an academic research paper
- [GWCTF 2019]枯燥的抽奖
- What a beautiful rainbow
- [geek challenge 2019] rce me
猜你喜欢

Xss.haozi.me practice customs clearance

看知名企业们如何利用 Web3进行产业重塑

2022年中国网络视频市场年度综合分析

Cache与MMU管理

『百日百题 · 基础篇』备战面试,坚持刷题 第三话——分支语句!

【zer0pts CTF 2022】 Anti-Fermat

A great thinking problem cf1671d insert a progression
![[C language] string reverse order (recursive implementation)](/img/a1/9e603321d364c7f457116bd9e462aa.png)
[C language] string reverse order (recursive implementation)

(12) 51 Single Chip Microcomputer -- use DS18B20 to measure the outdoor temperature in Gongjiang West
![[GWCTF 2019]枯燥的抽奖](/img/ea/34567ad06fae524bd685a26a6d4899.png)
[GWCTF 2019]枯燥的抽奖
随机推荐
The interviewer asked the thread safe list, and I'm not afraid after reading it!
Unity implements simple Sketchpad drawing function (notes)
R语言使用hexSticker包将ggplot2包可视化的结果转换为六角图(六角贴、六角形贴纸、ggplot2 plot to hex sticker)
理解双亲委派模式
require、loadfile、dofile、load、loadstring
『百日百题 · 基础篇』备战面试,坚持刷题 第三话——分支语句!
「图神经网络:基础、前沿与应用」最新IJCAI2022教程
Legendary server: what must be modified when the GOM geem2 engine is updated?
Notes on Shangpin project in shangsilicon Valley (I)
Cache and MMU management
Prepare for the interview and stick to the third sentence of the question - Branch sentences!
adb路径不能包含2空格remote couldn‘t create file: Is a directory
How to deal with the website after it is hacked and how to delete batch malicious code
论文写作全攻略|一篇学术科研论文该怎么写
View the construction details of Yongzhou dioxin Laboratory
永州植物细胞实验室建设布局方案
MQTT----mqtt.fx客户端软件
NPM related information
QT with OpenGL (shadow mapping)
Use a grayscale filter