当前位置:网站首页>452. 用最少数量的箭引爆气球
452. 用最少数量的箭引爆气球
2022-06-10 22:50:00 【anieoo】
原题链接:452. 用最少数量的箭引爆气球
solution:
贪心策略:将所有区间按右端点从小到大进行排序,每次选择区间的右端点进行射击。

class Solution {
public:
int findMinArrowShots(vector<vector<int>>& points) {
int n = points.size();
sort(points.begin(),points.end(),[](const vector<int> &a, const vector<int> &b){
return a[1] < b[1];
});
int res = 1,ed = points[0][1];
for(int i = 1;i < n;i++) {
if(points[i][0] > ed) {
res++;
ed = points[i][1];
}
}
return res;
}
};边栏推荐
- LabVIEW使用MathScript Node或MATLAB脚本时出现错误1046
- 【Go语言学习】——并发编程
- Lambda learning records
- After deepin20 menu startup option, the self-test indicates that iwlwwifi is stopped
- 【Turtle表白合集】“海底月是天上月,眼前人是心上人。”余生多喜乐,长平安~(附3款源码)
- SystemVerilog (x) - user defined type
- How to handle the database query error with Emoji expression in Typecho- Xingze V Club
- 上海炒股开户是安全的吗?
- 【Opencv实战】寒冷的冬季,也会迎来漫天彩虹,这特效你爱了嘛?
- Insert sort
猜你喜欢

From the perspective of Confucius Temple IP crossover, we can see how the six walnuts become "butterflies" for the second time

LabVIEW和VDM提取色彩和生成灰度图像

Several common current transformer sampling circuits
![[appearance detection artifact] come on, please show me your unique skill (is this appearance worthy of the audience?)](/img/c4/b571bec5fe0cd2968e078a8231d0bd.png)
[appearance detection artifact] come on, please show me your unique skill (is this appearance worthy of the audience?)

Judgment and other issues: how to determine whether the judgment of the procedure is correct?
![[pyGame games] tank battle, how many childhood games do you remember?](/img/30/951fdbb944e026701af08c0c068cd8.png)
[pyGame games] tank battle, how many childhood games do you remember?

Dark horse headlines - Tencent's salary system reform has caused controversy; Intel expanded the recruitment of female engineers nationwide; Black horse is 100% employed really
![[pyGame games] interesting puzzle game: how many hamsters can you play? (source code attached)](/img/88/733cddca32491c4ac45102aa703815.jpg)
[pyGame games] interesting puzzle game: how many hamsters can you play? (source code attached)
![[pyGame games] I'm not afraid you can't walk the maze series: the ultimate AI walks the maze. After learning, it will take you to open the door to a new world ~ (with game source code)](/img/57/dcf291b044b5e5860a7fdc817076d5.jpg)
[pyGame games] I'm not afraid you can't walk the maze series: the ultimate AI walks the maze. After learning, it will take you to open the door to a new world ~ (with game source code)

What is the workflow of dry goods MapReduce?
随机推荐
Typecho blog site wide deployment of Tencent cloud CDN tutorial - Xingze V Club
集合删除元素技巧 removeIf
Error report of curl import postman
LabVIEW obtains the information of all points found by the clamp function
【Opencv实战】这个印章“神器”够牛,节省了时间提高了效率,厉害~(附完整源码)
【Pygame小游戏】不怕你走不过系列:极致AI走迷宫,学习完带你打开新世界大门~(附游戏源码)
Compared with the "South-to-North Water Transfer", what will the "east to west" of the fire bring to cloud computing?
[auto reply Script] happy new year. I typed every word myself, not forwarded it~
LabVIEW调用DLL时出现异常0xc0000005代码
LabVIEW phase locked loop (PLL)
In the month of safety production, Huangpu launched a publicity campaign for gas safety in shops
High speed data stream disk for LabVIEW
C language file operation
[pyGame] this "groundhog" game is going to be popular (come on, come on)
LabVIEW displays the time and date on the waveform chart or waveform chart
【Pygame小游戏】这款“打地鼠”小游戏要火了(来来来)
Four ways to add names to threads in the thread pool
[MVC&Core]ASP.NET Core MVC 视图传值入门
vtk.js中vtp下载
LabVIEW使用MathScript Node或MATLAB脚本时出现错误1046