当前位置:网站首页>LeetCode 732. 我的日程安排表 III
LeetCode 732. 我的日程安排表 III
2022-07-06 06:02:00 【Sasakihaise_】

【离散化的差分数组】
class MyCalendarThree {
// 离散差分数组 1:37
Map<Integer, Integer> map = new TreeMap();
public MyCalendarThree() {
}
public int book(int start, int end) {
map.put(start, map.getOrDefault(start, 0) + 1);
map.put(end, map.getOrDefault(end, 0) - 1);
int sum = 0, ans = 0;
for (var e: map.keySet()) {
sum += map.get(e);
ans = Math.max(sum, ans);
}
return ans;
}
}
/**
* Your MyCalendarThree object will be instantiated and called as such:
* MyCalendarThree obj = new MyCalendarThree();
* int param_1 = obj.book(start,end);
*/
边栏推荐
- Seven imperceptible truths in software testing
- 数学三大核心领域概述:几何
- Redistemplate common collection instructions opsforvalue (II)
- 华为BFD的配置规范
- Title 1093: character reverse order
- 数字三角形模型 AcWing 1015. 摘花生
- Amazon Engineer: eight important experiences I learned in my career
- Station B, Master Liu Er - dataset and data loading
- IPv6 comprehensive experiment
- As3013 fire endurance test of cable distribution system
猜你喜欢
![[course notes] Compilation Principle](/img/cc/34e86087cc5698f9bed91675369265.jpg)
[course notes] Compilation Principle

Grant Yu, build a web page you want from 0
![[untitled]](/img/5d/028b9d19e9a2b217f40198d4631db2.png)
[untitled]

IDEA 新UI使用

Basic knowledge of error

MPLS test report

VINS-Mono: A Robust and Versatile Monocular Visual-Inertial State Estimator

Application du Groupe Li dans gtsam
![[ram IP] introduction and experiment of ram IP core](/img/34/1c988456e32a8e9840d1d073caefbf.jpg)
[ram IP] introduction and experiment of ram IP core

Is it difficult for an information system project manager?
随机推荐
Clear floating mode
Gtest之TEST宏的用法
功能安全之故障(fault),错误(error),失效(failure)
Buuctf-[bjdctf2020]zjctf, but so (xiaoyute detailed explanation)
Web service connector: Servlet
局域网同一个网段通信过程
Network protocol model
養了只小猫咪
Interface test: what are the components of the URL in fiddler
Investment strategy discussion and market scale prediction report of China's solid state high power amplifier industry from 2022 to 2028
[ram IP] introduction and experiment of ram IP core
[web security] nodejs prototype chain pollution analysis
对数据安全的思考(转载)
Hongliao Technology: Liu qiangdong's "heavy hand"
The usage and difference between strlen and sizeof
IPv6 comprehensive experiment
【论文代码】SML部分代码阅读
【Postman】动态变量(也称Mock函数)
GTSAM中李群的運用
Mysql database master-slave cluster construction