Leetcode-cn.com 2022-07-05
🟡 729.my-calendar-i
🏷️ Tags
#design #segment_tree #binary_search #ordered_set
Description
实现一个
当两个日程安排有一些时间上的交叉时(例如两个日程安排都在同一时间内),就会产生 重复预订 。
日程可以用一对整数
实现
Example
🟡 729.my-calendar-i
🏷️ Tags
#design #segment_tree #binary_search #ordered_set
Description
实现一个
MyCalendar 类来存放你的日程安排。如果要添加的日程安排不会造成 重复预订 ,则可以存储这个新的日程安排。当两个日程安排有一些时间上的交叉时(例如两个日程安排都在同一时间内),就会产生 重复预订 。
日程可以用一对整数
start 和 end 表示,这里的时间是半开区间,即 [start, end), 实数 x 的范围为, start <= x < end 。实现
MyCalendar 类:MyCalendar() 初始化日历对象。boolean book(int start, int end) 如果可以将日程安排成功添加到日历中而不会导致重复预订,返回 true 。否则,返回 false 并且不要将该日程安排添加到日历中。Example
输入:
["MyCalendar", "book", "book", "book"]
[[], [10, 20], [15, 25], [20, 30]]
输出:
[null, true, false, true]
解释:
MyCalendar myCalendar = new MyCalendar();
myCalendar.book(10, 20); // return True
myCalendar.book(15, 25); // return False ,这个日程安排不能添加到日历中,因为时间 15 已经被另一个日程安排预订了。
myCalendar.book(20, 30); // return True ,这个日程安排可以添加到日历中,因为第一个日程安排预订的每个时间都小于 20 ,且不包含时间 20 。
307.range-sum-query-mutable.pdf
63 KB
leetcode.com 2022-07-31
🟡307.range-sum-query-mutable
🏷️ Tags
#array #design #binary_indexed_tree #segment_tree
🟡307.range-sum-query-mutable
🏷️ Tags
#array #design #binary_indexed_tree #segment_tree
218.the-skyline-problem.pdf
210.7 KB
leetcode.com 2022-09-30
🔴218.the-skyline-problem
🏷️ Tags
#array #divide_and_conquer #binary_indexed_tree #segment_tree #line_sweep #heap_priority_queue #ordered_set
🔴218.the-skyline-problem
🏷️ Tags
#array #divide_and_conquer #binary_indexed_tree #segment_tree #line_sweep #heap_priority_queue #ordered_set
1687.delivering-boxes-from-storage-to-ports.pdf
113.3 KB
leetcode.cn 2022-12-05
🔴1687.delivering-boxes-from-storage-to-ports
🏷️ Tags
#segment_tree #queue #array #dynamic_programming #monotonic_queue #heap_priority_queue
🔴1687.delivering-boxes-from-storage-to-ports
🏷️ Tags
#segment_tree #queue #array #dynamic_programming #monotonic_queue #heap_priority_queue
leetcode.cn 2023-04-16
🔴1157.online-majority-element-in-subarray
🏷️ Tags
#design #binary_indexed_tree #segment_tree #array #binary_search
🔴1157.online-majority-element-in-subarray
🏷️ Tags
#design #binary_indexed_tree #segment_tree #array #binary_search
Telegraph
online-majority-element-in-subarray
设计一个数据结构,有效地找到给定子数组的 多数元素 。 子数组的 多数元素 是在子数组中出现 threshold 次数或次数以上的元素。 实现 MajorityChecker 类:
leetcode.com 2023-07-21
🟡673.number-of-longest-increasing-subsequence
🏷️ Tags
#binary_indexed_tree #segment_tree #array #dynamic_programming
🟡673.number-of-longest-increasing-subsequence
🏷️ Tags
#binary_indexed_tree #segment_tree #array #dynamic_programming
Telegraph
number-of-longest-increasing-subsequence
Given an integer array nums, return the number of longest increasing subsequences. Notice that the sequence has to be strictly increasing. Example 1: Input: nums = [1,3,5,4,7] Output: 2 Explanation: The two longest increasing subsequences are [1, 3, 4,…
leetcode.cn 2023-11-13
🟡307.range-sum-query-mutable
🏷️ Tags
#design #binary_indexed_tree #segment_tree #array
🟡307.range-sum-query-mutable
🏷️ Tags
#design #binary_indexed_tree #segment_tree #array
Telegraph
range-sum-query-mutable
给你一个数组 nums ,请你完成两类查询。