当前位置:网站首页>LeetCode 732. My schedule III
LeetCode 732. My schedule III
2022-07-06 06:23:00 【Sasakihaise_】

【 Discrete difference array 】
class MyCalendarThree {
// Discrete difference array 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);
*/
边栏推荐
- F - True Liars (种类并查集+DP)
- SourceInsight Chinese garbled
- 記一個基於JEECG-BOOT的比較複雜的增删改功能的實現
- JDBC requset corresponding content and function introduction
- 對數據安全的思考(轉載)
- PHP uses redis to implement distributed locks
- LeetCode 731. 我的日程安排表 II
- Redis core technology and basic architecture of actual combat: what does a key value database contain?
- 自定义指定路由上的Gateway过滤器工厂
- Simulation volume leetcode [general] 1314 Matrix area and
猜你喜欢
随机推荐
10M25DCF484C8G(FPGA) AMY-6M-0002 BGA GPS模块
JDBC requset corresponding content and function introduction
[postman] collections - run the imported data file of the configuration
10m25dcf484c8g (FPGA) amy-6m-0002 BGA GPS module
sourceInsight中文乱码
联合索引的左匹配原则
Leaflet map
LeetCode 729. 我的日程安排表 I
Career advancement Guide: recommended books for people in big factories
黑猫带你学UFS协议第8篇:UFS初始化详解(Boot Operation)
On weak network test of special test
模拟卷Leetcode【普通】1296. 划分数组为连续数字的集合
D - How Many Answers Are Wrong
Simulation volume leetcode [general] 1143 Longest common subsequence
Simulation volume leetcode [general] 1062 Longest repeating substring
Online and offline problems
Simulation volume leetcode [general] 1109 Flight reservation statistics
[C language] qsort function
Black cat takes you to learn EMMC Protocol Part 10: EMMC read and write operation details (read & write)
D - How Many Answers Are Wrong





![[postman] collections - run the imported data file of the configuration](/img/85/7ac9976fb09c465c88f376b2446517.png)



