当前位置:网站首页>Force deduction method summary: find classes
Force deduction method summary: find classes
2022-07-02 08:09:00 【Villanelle#】
436. Look for the right range Medium lower_bound
Method 2021/11/10
Give you an interval array intervals , among intervals[i] = [starti, endi] , And each starti all Different .
Section i Of Right section It can be recorded as an interval j , And satisfy startj >= endi , And startj To minimize the .
Returns an interval consisting of each interval i Of Right section stay intervals An array of corresponding subscripts in . If a certain interval i There is no corresponding Right section , Then subscript i The value at is set to -1 .
Example :
Input :intervals = [[3,4],[2,3],[1,2]]
Output :[-1,0,1]
explain : about [3,4] , There is no such thing as “ On the right side ” Section .
about [2,3] , Section [3,4] Have the smallest “ Right ” The starting point ;
about [1,2] , Section [2,3] Have the smallest “ Right ” The starting point .
utilize map Press... Automatically when the container is inserted key Nature of sorting , Use map Container storage intervals The left interval value and the corresponding subscript in , When traversing each interval , Use map In container lower_bound
How to find key In the first >= Iterator of its right interval value , Its second Value is its subscript .
边栏推荐
猜你喜欢
I'll show you why you don't need to log in every time you use Taobao, jd.com, etc?
浅谈深度学习模型中的后门
OpenCV3 6.2 低通滤波器的使用
SQLyog远程连接centos7系统下的MySQL数据库
On the back door of deep learning model
服务器的内网可以访问,外网却不能访问的问题
用全连接层替代掉卷积 -- RepMLP
Using transformer for object detection and semantic segmentation
Fundamentals of music theory (brief introduction)
将恶意软件嵌入到神经网络中
随机推荐
Use of opencv3 6.2 low pass filter
利用Transformer来进行目标检测和语义分割
Embedding malware into neural networks
使用Matplotlib绘制图表初步
针对语义分割的真实世界的对抗样本攻击
业务架构图
Global and Chinese market of medicine cabinet 2022-2028: Research Report on technology, participants, trends, market size and share
w10升级至W11系统,黑屏但鼠标与桌面快捷方式能用,如何解决
AR系统总结收获
CarSim problem failed to start solver: path_ ID_ OBJ(X) was set to Y; no corresponding value of XXXXX?
OpenCV常用方法出处链接(持续更新)
C语言的库函数
Remplacer l'auto - attention par MLP
学习写文章格式
OpenCV3 6.2 低通滤波器的使用
11月24号,我们为“满月”庆祝
力扣每日一题刷题总结:字符串篇(持续更新)
Open3d learning note 3 [sampling and voxelization]
[learning notes] matlab self compiled image convolution function
Nacos service registration in the interface