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

痛定思痛,不忘初心

🔗
 楼主| heeee 2019-5-17 16:02:35 | 只看该作者
全局:
day 8: binary search
k closest in sorted array: find closest + sliding window
search in unknown sized sorted array
total occurrence: combine first occur and find closest
search in sorted matrix: 如果用left=mid/right=mid就用while left<right-1,防止死循环
回复

使用道具 举报

🔗
 楼主| heeee 2019-5-18 16:17:59 | 只看该作者
全局:
day 9:
sorting: bubble/select/insert/merge/quick/rainbow(竟然是我fb题)
reverse linked list: recursive/iterative
回复

使用道具 举报

🔗
 楼主| heeee 2019-5-19 16:18:51 | 只看该作者
全局:
day 10:
merge two sorted linked lists
linked list: selection/merge/quick sort:quicksort花了几小时,partition里面要分别处理大于和小于两种情况,应该返回head, head_prev, head_nxt, pivot, pivot_prev, pivot_nxt
回复

使用道具 举报

🔗
 楼主| heeee 2019-5-20 15:49:46 | 只看该作者
全局:
day 11:
coding 1h
tree: iterative inorder/preorder/postorder(inorder和postorder做法类似,stack元素是tuple(node, count))
stack: valid parenthese, evaluate reverse polish notation(import operator简化美观很多)

Data science 3h
AB testing
hypothese testing
回复

使用道具 举报

🔗
 楼主| heeee 2019-5-21 16:05:43 | 只看该作者
全局:
day 12:
balanced binary tree, symmetric binary tree, BST: 都用helper function实现divide & conquer (left/right subtree)
fibonacci number
reverse linked list, in pairs: recursive/iterative
n queens: dfs recursive,重点在判断左右对角线上的点,path length-》row, index->column
lowest common ancestor (exist):recursive dfs先遇到的即lca
lowest common ancestor (may not exist, w/ parent node):用parent node dfs把所有parent存下来,再dfs另一个node时返回在存下来的祖先集合里的节点;优化space:两个节点拉到相同高度同时dfs back找共同parent
回复

使用道具 举报

🔗
 楼主| heeee 2019-5-22 16:01:31 | 只看该作者
全局:
day 13:
merge k sorted arrays by heap: space O(k)
smallest range: heap space O(k)
perfect squares: BFS, 检查所有小于本身的平方数,递减下去,返回最快减到0的层数
daily temperatures: 用stack,存入递减的index,遇到递增pop所有小于当前数的index,time: O(n)
summary ranges: 处理各种corner case
回复

使用道具 举报

🔗
 楼主| heeee 2019-5-23 16:30:10 | 只看该作者
全局:
day 14:
al anagrams: hashmap and match counter
upside down tree: similar to reverse linked list
max difference of the tree: divide and conquer
k smallest: min heap or max heap
reverse w/o vowel: two pointer
top k frequent: hashmap
回复

使用道具 举报

🔗
 楼主| heeee 2019-5-24 15:49:45 | 只看该作者
全局:
day 15: gg的题都是各种拐弯抹角
226 invert binary tree: iterative, bottom up/top down recursive
399 evaluate division: graph + bfs
684 redundant connection: union find
777 swap adjacent in LR string: two pointer
844 backspace string compare: skip and compare
回复

使用道具 举报

🔗
FAIRa 2019-5-26 02:16:21 | 只看该作者
全局:
楼主加微信? abcde123abcde45
回复

使用道具 举报

🔗
 楼主| heeee 2019-5-28 04:40:35 | 只看该作者
全局:
补打day 16
practice union find: find(x) is to find x's root ancestor; union(x,y) is to add y as x's ancestor
number of islands
friend circles
redundant connection
accounts merge
most stones removed with same row or column
regions cut by slashes
insert delete getRandom

少刷一天:(

补打day 17
周六contest 1051-1054 3mdium 1 easy 不难,题目越来越不直接,还挺巧妙的
tree min depth
回复

使用道具 举报

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

本版积分规则

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