
TreeMap
文章平均质量分 90
flyatcmu
这个作者很懒,什么都没留下…
展开
-
Design Log Storage System
You are given several logs, where each log contains a unique ID and timestamp. Timestamp is a string that has the following format:Year:Month:Day:Hour:Minute:Second, for example,2017:01:01:23:59:59. All domains are zero-padded decimal numbers.Implement..原创 2022-03-12 12:15:00 · 179 阅读 · 0 评论 -
Tweet Counts Per Frequency
A social media company is trying to monitor activity on their site by analyzing the number of tweets that occur in select periods of time. These periods can be partitioned into smallertime chunksbased on a certain frequency (everyminute,hour, orday)....原创 2022-03-12 04:02:22 · 454 阅读 · 0 评论 -
My Calendar I
Implement aMyCalendarclass to store your events. A new event can be added if adding the event will not cause a double booking.Your class will have the method,book(int start, int end). Formally, t...原创 2020-05-04 01:54:17 · 352 阅读 · 0 评论 -
My Calendar II
Implement aMyCalendarTwoclass to store your events. A new event can be added if adding the event will not cause atriplebooking.Your class will have one method,book(int start, int end). Formally...原创 2020-05-04 12:59:18 · 273 阅读 · 0 评论 -
My Calendar III
Implement aMyCalendarThreeclass to store your events. A new event canalwaysbe added.Your class will have one method,book(int start, int end). Formally, this represents a booking on the half ope...原创 2020-05-04 13:16:04 · 276 阅读 · 0 评论 -
扫描线Sweep Line算法总结
Number of Airplanes in the Sky给出飞机的起飞和降落时间的列表,用序列interval表示. 请计算出天上同时最多有多少架飞机?Example样例 1:输入: [(1, 10), (2, 3), (5, 8), (4, 7)]输出: 3解释: 第一架飞机在1时刻起飞, 10时刻降落.第二架飞机在2时刻起飞, 3时刻降落.第三架飞机在5时刻...原创 2020-01-13 15:33:37 · 7235 阅读 · 1 评论 -
Number of Airplanes in the Sky
Given an listinterval, which are taking off and landing time of the flight. How many airplanes are there at most at the same time in the sky?ExampleExample 1:Input: [(1, 10), (2, 3), (5, 8), (...原创 2019-12-04 15:53:27 · 1003 阅读 · 0 评论 -
Meeting Rooms II
Given an array of meeting time intervals consisting of start and end times[[s1,e1],[s2,e2],...](si< ei), find the minimum number of conference rooms required.For example,Given[[0, 30],[5,...原创 2016-09-11 10:35:05 · 1084 阅读 · 0 评论 -
Find Right Interval
Given a set of intervals, for each of the interval i, check if there exists an interval j whose start point is bigger than or equal to the end point of the interval i, which can be called that j is on the "right" of i.For any interval i, you need to stor原创 2020-07-26 04:32:54 · 189 阅读 · 0 评论 -
Range Module
A Range Module is a module that tracks ranges of numbers. Your task is to design and implement the following interfaces in an efficient manner.addRange(int left, int right)Adds the half-open interval[left, right), tracking every real number in that int..原创 2020-06-28 11:51:46 · 210 阅读 · 0 评论 -
Odd Even Jump
You are given an integer arrayA. Fromsome starting index, you can make a series of jumps. The (1st, 3rd, 5th, ...)jumps in the series are calledodd numbered jumps, and the (2nd, 4th, 6th, ...) jumps in the series are calledeven numbered jumps.You ...原创 2020-06-25 11:56:59 · 287 阅读 · 0 评论 -
Max Sum of Rectangle No Larger Than K
Given a non-empty 2D matrixmatrixand an integerk, find the max sum of a rectangle in thematrixsuch that its sum is no larger thank.Example:Input: matrix = [[1,0,1],[0,-2,3]], k = 2Output: 2 Explanation:Because the sum of rectangle [[0, 1], [-...原创 2020-06-23 12:32:39 · 238 阅读 · 0 评论 -
Data Stream as Disjoint Intervals
Given a data stream input of non-negative integers a1, a2, ..., an, ..., summarize the numbers seen so far as a list of disjoint intervals.For example, suppose the integers from the data stream are 1, 3, 7, 2, 6, ..., then the summary will be:[1, 1][原创 2020-06-12 12:22:46 · 278 阅读 · 0 评论 -
Snapshot Array
Implement a SnapshotArray that supports the following interface:SnapshotArray(int length)initializes an array-like data structure with the given length.Initially, each element equals 0. void set(index, val)sets the element at the givenindexto be e...原创 2020-05-14 01:20:11 · 252 阅读 · 0 评论 -
Snapshot Array
Implement a SnapshotArray that supports the following interface:SnapshotArray(int length)initializes an array-like data structure with the given length.Initially, each element equals 0. void set(index, val)sets the element at the givenindexto be e...原创 2020-05-13 14:20:29 · 173 阅读 · 0 评论 -
Consistent Hashing II
In Consistent Hashing I we introduced a relatively simple consistency hashing algorithm. This simple version has two defects:After adding a machine, the data comes from one of the machines. The read...原创 2020-01-21 10:57:16 · 410 阅读 · 0 评论