Skip to content

Instantly share code, notes, and snippets.

@jianminchen
Created October 13, 2018 04:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jianminchen/6005ef9afb3c32dbfe0d4dd33e6808d6 to your computer and use it in GitHub Desktop.
Save jianminchen/6005ef9afb3c32dbfe0d4dd33e6808d6 to your computer and use it in GitHub Desktop.
How to work on leetcode algorithms?
http://www.1point3acres.com/bbs/thread-446715-1-1.html
狗家 offer 已签,分享下心得和 filter
Leetcode:第一遍 250,按顺序的 1 - 250。
第一遍建议先按题目类型的 tag 刷,把前 200/250/300/… 的题都认真写一遍。discussion board 一定要看。
第二遍 280,按 company tag 和面筋刷的。
Leetcode 会员一定要买,不要因小失大。第二遍刷的时候,不要死扣 accepted or not。重要的是思路,一道题思路明白了,edge case 分析清楚,代码写的像模像样就行了。如果能 accepted 最好,如果思路是对的,代码也看着 okay,但是就是有 bug 跑不出来。千万不要浪费太多时间在 debug 上,直接去 discussion board 复制答案提交,标记成做过的就行了。因为 interviewer,hc 都不会跑你的代码!切记,重要的是思路!
时间的话,我训练的标准是 easy 10 mins,medium 20 mins, hard 30 mins。如果没有按时写完,用 easy 5m, medium 10m, hard 15m 的时间看 discussion board。如果还没看懂,就把题目记下来,以后多看几遍。
面经:
面经非常有用!我 9 月的 onsite,准备了 5 - 9 月份所有的面经。我的 onsite 的题目 3/4 是面经和面经的变种。面经题里一道是高频题变形,两道是低频题和变形。
看面经一定要写代码。能写出代码的思路才叫思路。有时候脑中思考了下,以为自己会写了,但真要写代码的时候,却各种卡壳,甚至会发现自己的思路是错的!
我面的一道低频面经题,当初刷面经的时候就看了回帖的思路,思考了下觉得懂了就没有动手写。结果面试的时候就懵逼了,当初把问题想简单了,还好临场发挥一步步把题目和 follow up 写出来了。而另一道低频面经,因为当初大概码了下代码,交流写码都非常的顺畅。
所以,一定要动手写代码!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment