452. Minimum Number of Arrows to Burst Balloons
来源:互联网 发布:小篆转换器软件下载 编辑:程序博客网 时间:2024/06/05 18:08
经典的区间选点问题,greedy策略
class Solution {public: static bool cmp(pair<int, int>& a,pair<int,int>& b) { if(a.second<b.second) return true; else if(a.second==b.second&&a.first<b.first) return true; else return false; } int findMinArrowShots(vector<pair<int, int>>& points) { if(points.size()==0) return 0; sort(points.begin(),points.end(),cmp); int now=0; int next=1; int count=1; while(next<points.size()) { if(points[now].second>=points[next].first) next++; else { count++; now=next; next++; } } return count; }};
0 0
- Minimum Number of Arrows to Burst Balloons
- Minimum Number of Arrows to Burst Balloons
- Minimum Number of Arrows to Burst Balloons
- LeetCode 452. Minimum Number of Arrows to Burst Balloons
- 452. Minimum Number of Arrows to Burst Balloons
- 【leetcode】452. Minimum Number of Arrows to Burst Balloons【M】
- 452. Minimum Number of Arrows to Burst Balloons
- LeetCode 452. Minimum Number of Arrows to Burst Balloons
- 452. Minimum Number of Arrows to Burst Balloons
- 452. Minimum Number of Arrows to Burst Balloons
- Leetcode 452. Minimum Number of Arrows to Burst Balloons[medium]
- 452. Minimum Number of Arrows to Burst Balloons
- [leetcode] 452. Minimum Number of Arrows to Burst Balloons
- Leetcode-452. Minimum Number of Arrows to Burst Balloons
- 【LeetCode】 452. Minimum Number of Arrows to Burst Balloons
- 452. Minimum Number of Arrows to Burst Balloons
- [Leetcode] 452. Minimum Number of Arrows to Burst Balloons
- [leetcode]452. Minimum Number of Arrows to Burst Balloons
- centos6.5安装配置MongoDB3.4(tgz压缩包安装)
- Hive,Hbase,HDFS等之间的关系
- ServletConfig和ServletContext的意思
- C#快速便捷导出Excel
- 水仙花数
- 452. Minimum Number of Arrows to Burst Balloons
- C陷阱与缺陷-笔记-1
- 知乎问题:美腿是怎么炼成的-Python爬一趴
- ubuntu下Veins安装教程
- JotVM-D开发日记(01)
- 完全背包(一维数组版)
- 【C++】无法打开msvcirtd.lib,多个解决办法
- Labview与其他应用程序的接口设计
- 地理空间距离计算优化--by美团点评技术团队