楼主: heeee
跳转到指定楼层
上一主题 下一主题
收起左侧

痛定思痛,不忘初心

🔗
 楼主| heeee 2019-5-28 16:25:33 | 只看该作者
全局:
day 18
new 21 game: dp
expressive words: four pointers
my calendar II: two lists
logger rate limiter: hashmap to store obsolete timestamp
linked list cycle I/II: if fast pointer and slow pointer meets, there is a cycle. Move two pointers from head and intersect together, they will meet at the cycle entrance node.
回复

使用道具 举报

🔗
 楼主| heeee 2019-5-29 16:07:59 | 只看该作者
全局:
day 19 gg tag
longest word in dictionary through deleting: sort or no sort
next closest time: three condition (1. check next valid minute 2. check next valid hour 3. check the earliest time in the next day)
reorganize string: max heap
rotated digits: rotating 2/5/6/9 changes value; rotating 0/1/8 not change
find and replace in string: previous index; reverse match
hand of straights: hashmap
online election: initialize the lead at each timestamp
回复

使用道具 举报

🔗
 楼主| heeee 2019-5-30 14:56:17 | 只看该作者
全局:
day 20:
merge k sorted lists: recursive space-O(logn); iterative-space O(1)
BFS: initial queue with start point, pop queue and push next level/visited, return result or empty queue
perfect squares
open the lock
bus routes
minimum area rectangle
回复

使用道具 举报

🔗
 楼主| heeee 2019-5-31 15:47:56 | 只看该作者
全局:
day 21:
android unlock patterns: use dfs. bfs is TLE, the queue at one time is too large.
flip equivalent binary trees: recursive, bottom up
odd even jump: (hard) Initialize next jump for odd/even steps. Check every index if it can DFS to the last. Loop from end to start to reuse checked results.
回复

使用道具 举报

🔗
 楼主| heeee 2019-6-1 02:42:43 | 只看该作者
全局:
本帖最后由 heeee 于 2019-6-1 02:48 编辑

看了别人的打卡贴,感觉自己写的太简略了,只有自己能看懂,自己太浮躁了。补充一下最近收获:
1. 现在学习的时候用一个软件FLIP,手机屏幕朝下就开始计时,可以限制自己使用手机,同时可以设立每日任务目标,比如coding 4h,DS 4h per day
2. 刷题容易忘,还没找到好方法总结复习。看到进步的地方是,过去要很长时间理解的题现在好像没那么困难了,hard题也不是像过去想象的无法触碰。推荐一个很好的LC中文解题blog:https://buptwc.com/tags/Leetcode-problems/,还有一个关于如何准备tech interview的repo:https://github.com/yangshun/tech-interview-handbook
3. DS坚固基础很重要,花在DS的时间还是少了,可能还是动力不够+年龄大了一看数学就困。。。(今天就好好复习一下DS吧)


回复

使用道具 举报

🔗
 楼主| heeee 2019-6-2 16:25:47 | 只看该作者
全局:
day 22:
contest:
1071. GCD of strings: recursive
1072. flip columns for maximum number of equal rows: just count row pattern
904. fruit into basket: hashmap记录种类+two pointer记录之前种类的index,方便之后从hashmap删除
review:
container with most water
longest substring without repeating characters
回复

使用道具 举报

🔗
 楼主| heeee 2019-6-3 06:47:01 | 只看该作者
全局:
签到答题,Miami university竟然不在Miami?题目要这么tricky吗- -
回复

使用道具 举报

🔗
 楼主| heeee 2019-6-4 16:03:36 | 只看该作者
全局:
day 23:
LRU cache: use python ordereddict to simulate recently usage. get() will pop and set key again, put() will set key or pop the least recently used item by popitem(last=False) function
design tictactoe: my method costs O(n^2) space and O(n) time, and can be optimized to O(n) space and O(1) time. The trick is to set two players as 1 and -1. Just store one row sum array, one column sum array, left diag sum value and right diag sum value.
decode string: use stack and check condition for each character
smallest k numbers: min heap and max heap
second largest in bst: reversed in-order traverse
回复

使用道具 举报

🔗
 楼主| heeee 2019-6-5 02:47:19 | 只看该作者
全局:
DS这几天复习了linear regression, logistic regression, SQL
回复

使用道具 举报

🔗
 楼主| heeee 2019-6-6 15:23:12 | 只看该作者
全局:
day 24
longest increasing subsequence: dp find and update the number of smaller numbers before each value; optimization: use binary search to update the max range if the value is smaller or larger than the smallest/biggest value of the max range
pow(x,n): negative exponent handling
snakes and ladders: bfs, note that matrix[~0][~0] is the right bottom value
top k frequent words: define word tuple class for comparison (customize function __lt__(self, other))

day 25:
spiral matrix I/II: same logic, loop through top/right/bottom/left and go to next round
move zeros
plus one: list slicing and insert are both O(n)
DS: hadoop

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册账号
隐私提醒:
  • ☑ 禁止发布广告,拉群,贴个人联系方式:找人请去🔗同学同事飞友,拉群请去🔗拉群结伴,广告请去🔗跳蚤市场,和 🔗租房广告|找室友
  • ☑ 论坛内容在发帖 30 分钟内可以编辑,过后则不能删帖。为防止被骚扰甚至人肉,不要公开留微信等联系方式,如有需求请以论坛私信方式发送。
  • ☑ 干货版块可免费使用 🔗超级匿名:面经(美国面经、中国面经、数科面经、PM面经),抖包袱(美国、中国)和录取汇报、定位选校版
  • ☑ 查阅全站 🔗各种匿名方法

本版积分规则

>
快速回复 返回顶部 返回列表