当前位置:网站首页>Simulated exhaustive 731 My schedule II
Simulated exhaustive 731 My schedule II
2022-07-21 11:52:00 【A little dog】
Simulated exhaustion 731. My schedule II
Start thinking
If three line segments appear in a period , Is triple
Violent traversal
class MyCalendarTwo {
List<int[]> booked;
List<int[]> overlaps;
public MyCalendarTwo() {
booked = new ArrayList<int[]>();
overlaps = new ArrayList<int[]>();
}
public boolean book(int start, int end) {
for(int[] arr:overlaps){
int l = arr[0], r = arr[1];
if (l < end && start < r) {
return false;
}
}
for (int[] arr : booked) {
int l = arr[0], r = arr[1];
if (l < end && start < r) {
overlaps.add(new int[]{
Math.max(l, start), Math.min(r, end)});
}
}
booked.add(new int[]{
start,end});
return true;
}
}
Please correct me if there is any mistake
边栏推荐
- 打脸华为?苹果与高通火速和解,但背后代价很大!
- Samsung announced the completion of the research and development of the 5-nm EUV process: the performance is improved by 10% and the power consumption is reduced by 20%!
- 2021-9-21
- Distributed high concurrency and high availability fastdfs file server cluster deployment
- 微信小程序 02 Hello miniProgram
- MySQL实现基于binlog的主从同步、主主同步
- 《程序设计基础》 第十章 函数与程序结构 6-13 分治法求解金块问题 (20 分)
- Could not resolve all dependencies for configuration的解决方案
- 《程序设计基础》 第十章 函数与程序结构 6-6 递归实现顺序输出整数 (15 分)
- Wechat applet 05 obtains basic user information
猜你喜欢
Introduction to chrome plug-in development -- CSDN login free copy, attention free view
2021-9-21
Selection bias induced spurious correlations in large language models
Netflix、麻省理工学院 | Uncertainty in Contrastive Learning: On the Predictability of Downstream Performance(对比学习中的不确定性:关于下游性能的可预测性)
Improvement of wechat applet 24 playing music page ①
山东大学、北邮、哈工大| Multimodal Dialog Systems with Dual Knowledge-enhanced Generative Pretrained Language Model(具有双重知识增强生成预训练语言模型的多模态对话系统)
2021-9-19
微信小程序 04 路由跳转和生命周期函数
2021-9-22
龙蜥社区发布首个 Anolis OS 安全指南 为用户业务系统保驾护航
随机推荐
分布式高并发高可用FastDFS文件服务器集群部署
Could not resolve all dependencies for configuration的解决方案
Leetcode挺进10W
《程序设计基础》 第十章 函数与程序结构 6-13 分治法求解金块问题 (20 分)
"Fundamentals of program design" Chapter 10 function and program structure 6-7 judge the three digits that meet the conditions (15 points)
助力AI产业落地,云知声展示全栈AI硬核技术
个人学习 _numpy
sqlilabs less-25~25a
416. Segmentation and subsets
"Fundamentals of program design" Chapter 10 function and program structure 7-1 circular volume calculator (20 points)
Unity Shader学习(五)鼠标移动方块
【云原生】DevOps(四):集成Sonar Qube
Wechat applet 21 improve video page ②
mysql数据库 if buf[0] == 251: # \xfb IndexError: bytearray index out of range
How to use Apache to build URL shortening service
《程序设计基础》 第十章 函数与程序结构 6-7 判断满足条件的三位数 (15 分)
Leetcode breaks the 7W mark
专业的人做专业的事 GBASE参编数据库发展研究报告(2022年)、入选全球数据库产业图谱
《程序设计基础》 第十章 函数与程序结构 7-1 圆形体体积计算器 (20 分)
HTB-Lame