赞
踩
已知一个平面上有一定数量的气球,平面可以看做一个坐标系,在平面的x轴的不同位置安排弓箭手向y轴方向射箭,弓箭可以向y轴走无穷远;给定气球的宽度xstart<=x<=xend。问至少需要多少弓箭手,将全部气球打爆?
例如:四个气球: [[10,16],[2,8],[1,6],[7,12]],至少需要2个弓箭手。
#include<algorithm>
#include<vector>
bool cmp(const std::pair<int, int>& a, const std::pair<int, int>& b)
{
return a.first < b.first;
}
class Solution
{
public:
int findMinArrowShots(std::vector<
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。