当前位置:网站首页>Greedy interval problem (5)
Greedy interval problem (5)
2022-06-30 14:37:00 【Douglas_ LT】
A daily topic ing, Today is a day medium topic 452. Minimum Number of Arrows to Burst Balloons
class Solution {
public:
static bool cmp(vector<int>& a,vector<int>& b)
{
return a[1]<b[1];
}
int findMinArrowShots(vector<vector<int>>& points)
{
sort(points.begin(),points.end(),cmp);
int num=0,i=0,flag=0;
while(i<points.size())
{
int right=points[i][1];
flag=1;
int j;
for(j=i+1;j<points.size();j++)
{
if(right<points[j][0])
{
i=j;
break;
}
}
i=j;
if(flag==1)
num++;
}
return num;
}
};
边栏推荐
- Pit used by go language array type
- Realize a simple LAN communication (similar to feiqiu)
- Go language for loop multivariable use
- Fastcgi CGI shallow understanding
- Alipay certificate mode payment interface
- [geek challenge 2019] PHP problem solving record
- ThinkPHP v3.2 comment annotation injection write shell
- Implementation of forwarding server using IO multiplexing
- Summary of FTP network protocol learning
- Attack and defense world web questions
猜你喜欢
Pytoch viewing model parameter quantity and calculation quantity
Detailed explanation of settimeout() and setinterval()
ThinkPHP v3.2 comment annotation injection write shell
【BUUCTF】 EasySql
[geek challenge 2019] PHP problem solving record
2021-07-14 mybaitsplus
Shell programming overview
August 24, 2021 deque queue and stack
"Persistent diseases" that cannot be solved in IM application development
Mysql database foundation: stored procedures and functions
随机推荐
[scientific research data processing] [basic] category variable frequency analysis chart, numerical variable distribution chart and normality test (including lognormal)
Laravel RBAC laravel permission use
[geek challenge 2019] PHP problem solving record
Querywrapper in mybaits plus
【BUUCTF】 EasySql
Component communication mode
I love network security for new recruitment assessment
PS dynamic drawing
Meaning of while (~scanf ("%d%d", & A, & B))
XSS challenge (6-10) more detailed answers
@ResponseBody的作用
The difference between settimeout() and setinterval()
Jetpack compose for perfect screen fit
C language & the difference between the address pointed to and the address pointed to by the pointer
V3_ Chrome extended Chinese translation document V3 directory
Mutex lock, read / write lock, spin lock, pessimistic lock, and optimistic lock
Mysql database foundation: stored procedures and functions
PHP excel export function encapsulation (based on phpexcel class)
DiceCTF - knock-knock
Problems in QT creator (additional unknown and error lines are listed in the debug output window)