当前位置:网站首页>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);
*/
边栏推荐
- Réflexions sur la sécurité des données (réimpression)
- Play video with Tencent video plug-in in uni app
- JDBC requset corresponding content and function introduction
- Simulation volume leetcode [general] 1091 The shortest path in binary matrix
- [eolink] PC client installation
- Still worrying about how to write web automation test cases? Senior test engineers teach you selenium test case writing hand in hand
- 模拟卷Leetcode【普通】1296. 划分数组为连续数字的集合
- Past and present lives of QR code and sorting out six test points
- Database - current read and snapshot read
- LeetCode 729. 我的日程安排表 I
猜你喜欢

JWT-JSON WEB TOKEN

org.activiti.bpmn.exceptions.XMLException: cvc-complex-type.2.4.a: 发现了以元素 ‘outgoing‘ 开头的无效内容

LeetCode 739. 每日温度

Basic knowledge of MySQL

10m25dcf484c8g (FPGA) amy-6m-0002 BGA GPS module

Redis core technology and basic architecture of actual combat: what does a key value database contain?

The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower

Database isolation level

How to extract login cookies when JMeter performs interface testing

F - true liars (category and search set +dp)
随机推荐
D - How Many Answers Are Wrong
浅谈专项测试之弱网络测试
PHP uses redis to implement distributed locks
模拟卷Leetcode【普通】1218. 最长定差子序列
RestTemplate、Feign实现Token传递
[no app push general test plan
The latest 2022 review of "graph classification research"
LeetCode 1200. 最小绝对差
Caused by:org. gradle. api. internal. plugins . PluginApplicationException: Failed to apply plugin
php使用redis实现分布式锁
Simulation volume leetcode [general] 1447 Simplest fraction
[eolink] PC client installation
Set the print page style by modifying style
Data type of MySQL
Simulation volume leetcode [general] 1296 Divide an array into a set of consecutive numbers
Redis core technology and basic architecture of actual combat: what does a key value database contain?
Simulation volume leetcode [general] 1061 Arrange the smallest equivalent strings in dictionary order
【MQTT从入门到提高系列 | 01】从0到1快速搭建MQTT测试环境
MFC关于长字符串unsigned char与CString转换及显示问题
调用链监控Zipkin、sleuth搭建与整合