当前位置:网站首页>力扣方法总结:查找类
力扣方法总结:查找类
2022-07-02 06:28:00 【Villanelle#】
436. 寻找右区间Medium lower_bound方法2021/11/10
给你一个区间数组 intervals ,其中 intervals[i] = [starti, endi] ,且每个 starti 都 不同 。
区间 i 的 右侧区间 可以记作区间 j ,并满足 startj >= endi ,且 startj 最小化 。
返回一个由每个区间 i 的 右侧区间 在 intervals 中对应下标组成的数组。如果某个区间 i 不存在对应的 右侧区间 ,则下标 i 处的值设为 -1 。
示例:
输入:intervals = [[3,4],[2,3],[1,2]]
输出:[-1,0,1]
解释:对于 [3,4] ,没有满足条件的“右侧”区间。
对于 [2,3] ,区间[3,4]具有最小的“右”起点;
对于 [1,2] ,区间[2,3]具有最小的“右”起点。
利用map容器插入时自动按key排序的性质,使用map容器存储intervals中的左区间值和对应下标,遍历各区间时,使用map容器中的lower_bound方法找到key中首个>=其右区间值的迭代器,其second值即为其下标。
边栏推荐
- 针对tqdm和print的顺序问题
- Open3D学习笔记一【初窥门径,文件读取】
- C # connect to MySQL database
- Nacos service registration in the interface
- Dynamic extensible representation for category incremental learning -- der
- 11月24号,我们为“满月”庆祝
- 業務架構圖
- Network metering - transport layer
- [binocular vision] binocular correction
- 【AutoAugment】《AutoAugment:Learning Augmentation Policies from Data》
猜你喜欢

Vscode下中文乱码问题

【Sparse-to-Dense】《Sparse-to-Dense:Depth Prediction from Sparse Depth Samples and a Single Image》

Income in the first month of naked resignation

利用Transformer来进行目标检测和语义分割

【Programming】

浅谈深度学习模型中的后门
![[multimodal] clip model](/img/45/8501269190d922056ea0aad2e69fb7.png)
[multimodal] clip model
![[CVPR‘22 Oral2] TAN: Temporal Alignment Networks for Long-term Video](/img/bc/c54f1f12867dc22592cadd5a43df60.png)
[CVPR‘22 Oral2] TAN: Temporal Alignment Networks for Long-term Video

Nacos service registration in the interface

Eklavya -- infer the parameters of functions in binary files using neural network
随机推荐
What if the laptop task manager is gray and unavailable
Real world anti sample attack against semantic segmentation
Apple added the first iPad with lightning interface to the list of retro products
【Cascade FPD】《Deep Convolutional Network Cascade for Facial Point Detection》
The internal network of the server can be accessed, but the external network cannot be accessed
11月24号,我们为“满月”庆祝
How gensim freezes some word vectors for incremental training
Thesis tips
Open3d learning note 4 [surface reconstruction]
【双目视觉】双目立体匹配
Using transformer for object detection and semantic segmentation
【Sparse-to-Dense】《Sparse-to-Dense:Depth Prediction from Sparse Depth Samples and a Single Image》
【双目视觉】双目矫正
服务器的内网可以访问,外网却不能访问的问题
稀疏矩阵存储
JVM instructions
【雙目視覺】雙目矯正
Label propagation
Programmers can only be 35? The 74 year old programmer in the United States has been programming for 57 years and has not retired
SQL server如何卸载干净