高级农民
- 积分
- 1213
- 大米
- 颗
- 鳄梨
- 个
- 水井
- 尺
- 蓝莓
- 颗
- 萝卜
- 根
- 小米
- 粒
- 学分
- 个
- 注册时间
- 2013-10-19
- 最后登录
- 1970-1-1
|
6/4 Mon
616. Add Bold Tag in String, similar to Merge Interval
56. Merge Intervals
817. Linked List Components, Linked List
6/5 Tue
484. Find Permutation
778. Swim in Rising Water, Min Heap
max: max time at cur position
everytime change unvisited neighbor cell's (x, y) time into max(grid[x][y], max)
and put them into pq
6/6 Wed
39. Similar String Groups, Union Find
455. Assign Cookies, Arrays sort + two pointer, greedy
122. Best Time to Buy and Sell Stock II, just cumulate the profits
763. Partition Labels
Interval
452. Minimum Number of Arrows to Burst Balloons, Arrays sort, greedy; sort by start time
435. Non-overlapping Intervals, Arrays sort, greedy; sort by end time
if we choose the interval that ends earlier, then there is more space for other intervals
253. Meeting Rooms II, Arrays sort and use PriorityQueue
先画图,模拟增加房间。正常思维会从开始时间短的开始加。每次遇到新的interval,都会考虑end最早的。如果可以合并则合并。如果不可以则新加房间。如果最早end的都不行,其他都不用考虑了。所以先按照start time sort,min pq是按end time
6/7 Thur
134. Gas Station
If the total number of gas is bigger than the total number of cost. There must be a solution.
738. Monotone Increasing Digits 自己想不到。。。
674. Longest Continuous Increasing Subsequence
747. Largest Number At Least Twice of Others, one pass, find largest and secLargest
624. Maximum Distance in Arrays
605. Can Place Flowers, Greedy
581. Shortest Unsorted Continuous Subarray, sort solution, O(n) time 还没做
562. Longest Line of Consecutive One in Matrix, DP
note need to differentiate the dp value from different directions |
|