当前位置:网站首页>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);
*/
边栏推荐
- JWT-JSON WEB TOKEN
- [C language] string left rotation
- MFC关于长字符串unsigned char与CString转换及显示问题
- Postman core function analysis - parameterization and test report
- E - food chain
- leetcode 24. Exchange the nodes in the linked list in pairs
- Selenium source code read through · 9 | desiredcapabilities class analysis
- [postman] dynamic variable (also known as mock function)
- Testing of web interface elements
- Properties file
猜你喜欢
LeetCode 731. 我的日程安排表 II
Digital triangle model acwing 1015 Picking flowers
[no app push general test plan
D - How Many Answers Are Wrong
Career advancement Guide: recommended books for people in big factories
10m25dcf484c8g (FPGA) amy-6m-0002 BGA GPS module
JMeter做接口测试,如何提取登录Cookie
[eolink] PC client installation
Convert the array selected by El tree into an array object
Caused by:org. gradle. api. internal. plugins . PluginApplicationException: Failed to apply plugin
随机推荐
[postman] test script writing and assertion details
[no app push general test plan
一文揭开,测试外包公司的真 相
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
在JEECG-boot代码生成的基础上修改list页面(结合自定义的组件)
模拟卷Leetcode【普通】1414. 和为 K 的最少斐波那契数字数目
MFC dynamically creates dialog boxes and changes the size and position of controls
Simulation volume leetcode [general] 1219 Golden Miner
RestTemplate、Feign实现Token传递
Thoughts on data security (Reprint)
模拟卷Leetcode【普通】1061. 按字典序排列最小的等效字符串
LeetCode 739. 每日温度
把el-tree选中的数组转换为数组对象
F - True Liars (种类并查集+DP)
数据库-当前读与快照读
[postman] dynamic variable (also known as mock function)
模拟卷Leetcode【普通】1249. 移除无效的括号
On weak network test of special test
Coordinatorlayout+nestedscrollview+recyclerview pull up the bottom display is incomplete
selenium源码通读·9 |DesiredCapabilities类分析