查看: 2591| 回复: 34
跳转到指定楼层
上一主题 下一主题
收起左侧

定个小目标,刷个300题

全局:

注册一亩三分地论坛,查看更多干货!

您需要 登录 才可以下载或查看附件。没有帐号?注册账号

x
研究生申请总算有个心仪的项目,也放下心来了。接下来准备刷题。前几年累计刷了100多题,今年年初重新开始,现在75题。现在3月中旬,到8月底开学有6个月,其中3个月没有工作,应该不算太难。

目标:
周一到周五:每天刷4题 + 总结
周六到周日:复习这周刷的10题

如果按照计划来的话:20题/周 * 4周/月 * 6个月 = 480题,给自己一些wiggle room,和犯懒的机会 哈哈。
之前做题从来没有总结过,现在希望每次做完要总结一下。不知道要花多少时间,加上准备上公开课,有可能需要更改目标(尽量保持)。

上一篇:Python 刷题记录贴,太健忘了感觉要来回刷才行
下一篇:[LeetCode]刷题打卡,目标6月底500题
推荐
 楼主| xxcindy 2021-4-1 11:41:14 | 只看该作者
全局:
Day 14: 2021-03-31

[33] Search in Rotated Sorted Array - M
[69] Sqrt(x) - E
[34] Find First and Last Position of Element in Sorted Array - M
[81] Search in Rotated Sorted Array II - M

主要focus在binary search
Num of Q solved: 99
Repo: https://github.com/xindixu/leetc ... 839bc7284055cac8048
回复

使用道具 举报

推荐
 楼主| xxcindy 2021-4-20 11:12:16 | 只看该作者
全局:
Day 25: 2021-04-19

34        Find First and Last Position of Element in Sorted Array        Binary Search        upper/lower bound        M
704        Binary Search        Binary Search        find target        E
981        Time Based Key-Value Store        Binary Search        upper/lower bound        M
1011        Capacity To Ship Packages Within D Days        Binary Search        guess and check        M
1482        Minimum Number of Days to Make m Bouquets        Binary Search        guess and check        M

Num of Q solved: 114 -> 118

回复

使用道具 举报

推荐
 楼主| xxcindy 2021-3-20 12:51:32 | 只看该作者
全局:
Day 2: 2021-03-19

74. Search in 2D Array [M]:
Just look at the sorted matrix as a 1D sorted array and perform a binary search. Pay attention to the way we get the index.
start = 0, end = rows * cols - 1, r = mid // cols, c = mid % cols

75. Sort Colors [M]:
Segment list into three parts. endOf0, endOf1, startOf2.
Loop to move endOf1 and startOf2 closer to each other.
Take an item with endOf1, consider if we should move it to segment 0 or segment 2. If we should move it, swap with the original item.
Update marker

78. Subsets [M]:
Cascade:
result = []
local = for each item, add that item to the result
add local to result

Backtracking...
Do it by layers.

90. Subset II [M]:
Cascade: Same as 78, but check for duplicates before adding local to result

Backtracking: Same as 78, but skip if nums== nums[i-1] && i > start

Num of Q solved 78 -> 82

Repo: https://github.com/xindixu/leetc ... 4191e0546641e605cb8
花太多时间了。明天好好体会练习下backtracking。
我觉得有点太难了。准备上门公开课复习复习算法先。
回复

使用道具 举报

🔗
 楼主| xxcindy 2021-3-19 12:54:27 | 只看该作者
全局:
本帖最后由 xxcindy 于 2021-3-19 13:10 编辑

Day 1: 2021-03-18

62. Unique Paths [M]: 2D dp -> init the first row, first col -> fill the rest || math combination problem


63. Unique Paths II [M]:
2D dp -> init the first row, first col -> fill the rest


64. Minimum Path Sum [M]:
2D dp -> init the first row, first col -> fill the rest


73. Set Matrix Zeros [M]:
All cols but first -> coll grid but first row and col -> first row -> first col
Gotcha: first grid should be used for the first row. Use another flag to track the first col

Num of Q solved: 74 -> 78

Repo: https://github.com/xindixu/leetc ... b69f8ee8aba3aa224ab
Time spent: ... 3.5 hr?
觉得花的时间有点多,不知道之后还能不能不保证每天4题 finger crossed.

回复

使用道具 举报

🔗
 楼主| xxcindy 2021-3-21 12:05:32 | 只看该作者
全局:
Day 3: 2021-03-20

(review day)

55. Jump Game [M]
45. Jump Game II [M]
48. Rotate Image [M]
169. Majority Element [E]
189. Rotate Array [M]
54. Spiral Matrix [M]
59. Spiral Matrix II [M]
56. Merge Intervals [M]

Num of Q reviewed: 8

Repo: https://github.com/xindixu/leetc ... a7f0b8e4bbcfa2d192c
需要调整计划。如我所料,一周之后什么都不记得了……
回复

使用道具 举报

🔗
 楼主| xxcindy 2021-3-22 12:19:34 | 只看该作者
全局:
Day 4: 2021-03-21

(review day)

[57] Insert Interval - M <need review>
[228] Summary Ranges - M
[62] Unique Paths - M
[63] Unique Paths II - M
[64] Minimum Path Sum - M
[73] Set Matrix Zeroes - M
[74] Search a 2D Matrix - M
[75] Sort Colors - M

Num of Q reviewed: 8

Repo: https://github.com/xindixu/leetc ... 21f0a1838ac45947e57
明天先看看要怎么调整计划吧,基本上就是有些题目有非常好理解的解法,加上elegant solution,我能记得住并且快速解题。其他的题目想半天还是无法pass。
回复

使用道具 举报

🔗
 楼主| xxcindy 2021-3-23 11:00:05 | 只看该作者
全局:
Day 5: 2021-03-22

[79] Word Search - M
[17] Letter Combinations of a Phone Number - M
[22] Generate Parentheses - M
[77] Combinations

Num of Q solved 82 -> 86

Repo: https://github.com/xindixu/leetc ... 16f52b298179e27b94e
今天刷的都是backtracking problem。总算弄明白了。

至于计划,改成周三周日复习,其他时间一天先继续4题,尽量是同一个类型的。看看以后如果没时间的话在调整

回复

使用道具 举报

🔗
 楼主| xxcindy 2021-3-24 11:45:44 | 只看该作者
全局:
本帖最后由 xxcindy 于 2021-3-24 11:46 编辑

Day 6: 2021-03-23

[46] Permutations - M
[47] Permutations II - M
[131] Palindrome Partitioning - M
[216] Combination Sum III - M

Num of Q solved 86 ->90 (E 40, M 49, H 1)

Repo: https://github.com/xindixu/leetc ... 86fdaf92940da65ef08
继续backtracking,有些心得:
- 想想怎么画一个tree- terminating condition
- 每一层里的每个branch有什么不同,有多少个branch (这个对应loop)
- 从这层到下一层要怎么变化,注意不要重复了 (这个对于backtrack fn的arguments)

- 有些avoid duplicating的办法:
    - Sort the array and only move forward
    - Check if the current one is the same as the previous one. If yes, skip backtracking

回复

使用道具 举报

🔗
 楼主| xxcindy 2021-3-25 11:43:28 | 只看该作者
全局:
Day 7: 2021-03-24

Review day

[17] Letter Combinations of a Phone Number - M
[22] Generate Parentheses - M
[77] Combinations - M
[39] Combination Sum - M
[40] Combination Sum II - M

Num of Q Reviewed: 5

Repo: https://github.com/xindixu/leetc ... 8cae1c88fb006ab56ee
今日状态不佳…… 继续复习backtracking
回复

使用道具 举报

🔗
 楼主| xxcindy 2021-3-26 12:45:55 | 只看该作者
全局:
Day 8: 2021-03-25

今天只做了2题,花了些时间做公开课的project。

[89] Gray Code - M
[93] Restore IP Addresses - M

Num of Q solved 90 -> 92
Repo: https://github.com/xindixu/leetc ... ab2550912f9aaaa0f9f
回复

使用道具 举报

🔗
 楼主| xxcindy 2021-3-27 13:20:56 | 只看该作者
全局:
Day 9: 2021-03-26

继续2道题
[36] Valid Sudoku - M
[37] Sudoku Solver - H

Num of Q solved 92 -> 94

Repo: https://github.com/xindixu/leetc ... 53754b343823d4cfc85
回复

使用道具 举报

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

本版积分规则

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