当前位置:网站首页>leetcode435. Non overlapping interval
leetcode435. Non overlapping interval
2022-07-03 04:58:00 【Day by day, the dish chicken Jie!!】
One : The analects of Confucius
different No common goal, no common cause to cooperate We have no reason to hold our own judgment Look at what others have experienced , There is no real empathy when you start again , What we can do is to respect the views of others , Keep your attitude .
Two : subject

3、 ... and : Upper code
class Solution {
public:
/** Ideas :1. Here, we still handle it in ascending order according to the second element of the interval array [[1,2],[1,3],[2,3],[3,4]] Here, as long as the right boundary of our interval array is less than the left boundary of the next array Then our final interval is Non overlapping . */
static bool cmp(const vector<int> & v1,const vector<int>& v2) {
return v1[1] < v2[1];
}
int eraseOverlapIntervals(vector<vector<int>>& intervals) {
sort(intervals.begin(),intervals.end(),cmp);
int temp = intervals[0][1];// First right boundary
int count = 1;// The number of interval arrays that meet the requirements ( Record first An interval array )
for(int i = 0; i < intervals.size(); i++) {
if(temp <= intervals[i][0]){
// If it is smaller than the left boundary , Then update the right boundary , At the same time, record the number of interval arrays that meet the requirements
temp = intervals[i][1];
count++;
}
}
return intervals.size() - count;
}
};
come on. Good night, A stranger
边栏推荐
- Hire cashier (differential constraint)
- Shuttle + Alluxio 加速内存Shuffle起飞
- [research materials] 2021 annual report on mergers and acquisitions in the property management industry - Download attached
- [PHP vulnerability weak type] basic knowledge, PHP weak equality, error reporting and bypassing
- The process of browser accessing the website
- Market status and development prospect prediction of the global fire hose industry in 2022
- Market status and development prospect prediction of the global autonomous hybrid underwater glider industry in 2022
- Oracle SQL table data loss
- What is UUID
- [set theory] relationship properties (symmetry | symmetry examples | symmetry related theorems | antisymmetry | antisymmetry examples | antisymmetry theorems)
猜你喜欢

Handler understands the record

Thesis reading_ Chinese medical model_ eHealth

Introduction to JVM principle

The consumption of Internet of things users is only 76 cents, and the price has become the biggest obstacle to the promotion of 5g industrial interconnection
![[luatos sensor] 2 air pressure bmp180](/img/88/2a6caa5fec95e54e3fb09c74ba8ae6.jpg)
[luatos sensor] 2 air pressure bmp180
![[XSS bypass - protection strategy] understand the protection strategy and better bypass](/img/72/d3e46a820796a48b458cd2d0a18f8f.png)
[XSS bypass - protection strategy] understand the protection strategy and better bypass

Automatic voltage rise and fall 5-40v multi string super capacitor charging chip and solution
![[clock 223] [binary tree] [leetcode high frequency]: 102 Sequence traversal of binary tree](/img/0f/bc8c44aee7a2c9dccac050b1060017.jpg)
[clock 223] [binary tree] [leetcode high frequency]: 102 Sequence traversal of binary tree

Do you know UVs in modeling?

Actual combat 8051 drives 8-bit nixie tube
随机推荐
Objects. Requirenonnull method description
[tools run SQL blind note]
Use Sqlalchemy module to obtain the table name and field name of the existing table in the database
2022-02-11 daily clock in: problem fine brush
[develop wechat applet local storage with uni app]
Market status and development prospect prediction of the global fire hose industry in 2022
Current market situation and development prospect forecast of global UV sensitive resin 3D printer industry in 2022
RT thread flow notes I startup, schedule, thread
2022-02-12 daily clock in: problem fine brush
【SQL注入】联合查询(最简单的注入方法)
[set theory] relational representation (relational matrix | examples of relational matrix | properties of relational matrix | operations of relational matrix | relational graph | examples of relationa
Huawei personally ended up developing 5g RF chips, breaking the monopoly of Japan and the United States
【批处理DOS-CMD命令-汇总和小结】-CMD窗口的设置与操作命令-关闭cmd窗口、退出cmd环境(exit、exit /b、goto :eof)
Market status and development prospect prediction of global colorimetric cup cover industry in 2022
1103 integer factorization (30 points)
Market status and development prospect prediction of global fermented plant protein industry in 2022
1086 tree traversals again (25 points)
Distinguish between releases and snapshots in nexus private library
Market status and development prospect forecast of global button dropper industry in 2022
[PHP vulnerability weak type] basic knowledge, PHP weak equality, error reporting and bypassing