随笔分类 -  tree set/ tree map

392. Is Subsequence
摘要:0 3 5 7 Prev = 4 Smallest larger or equal is 5 If prev = 8, return -1 阅读全文

posted @ 2018-11-09 11:25 猪猪🐷

436. 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 o... 阅读全文

posted @ 2018-11-09 10:30 猪猪🐷

218. The Skyline Problem
摘要:https://www.youtube.com/watch?v=8Kd-Tn_Rz7s Java有TreeMap和TreeSet。 阅读全文

posted @ 2018-11-08 16:53 猪猪🐷

853. Car Fleet
摘要:https://leetcode.com/problems/car-fleet/solution/ https://leetcode.com/problems/car-fleet/discuss/139999/Easy-understanding-JAVA-TreeMap-Solution-with-explanation-and-comment N cars are going ... 阅读全文

posted @ 2018-11-08 16:13 猪猪🐷

855. Exam Room
摘要:In an exam room, there are N seats in a single row, numbered 0, 1, 2, ..., N-1. When a student enters the room, they must sit in the seat that maximizes the distance to the closest person. If there ... 阅读全文

posted @ 2018-09-25 04:25 猪猪🐷

729. My Calendar I
摘要:Implement a MyCalendar class 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... 阅读全文

posted @ 2018-09-20 18:27 猪猪🐷

862. Shortest Subarray with Sum at Least K
摘要:If there is no non-empty subarray with sum at least K, return -1. Example 1: Input: A = [1], K = 1 Output: 1 Example 2: Input: A = [1,2], K = 4 Output 阅读全文

posted @ 2018-08-28 20:19 猪猪🐷

导航