The following content is selected or summarized from Cracking the code interview.
The Interview Process
Overview
The form of interview
Most of the interviews are screening interviews. However, the “screening interview” often involves coding and algorithms questions.
Some of the companies will take advantage of online synchronized document editors, while others will expect us to write code on paper and read it back over the phone. Some interviewers even give us “homework” to solve after we hang up the phone or just ask us to email them the code we wrote.
How Questions are Selected
The questions the interviewers get are the same as what we get, typically some data structures and algorithms or database problems, which depends on the specific company.
Timeline and Preparation Map
The Evaluation Process
The candidates will be evaluated by four aspects, prior experience, culture fit, coding skills and analytical ability. The coding skills and analytical ability are the most important parts.
Incorrect Answers
No “correct” or “incorrect”. We should care about how optimal of our final solution was, how long it took us to get there and how clean our code was.
Our performance is evaluated in comparison to other candidates.
Dress code
Top 10 Mistakes
- Practing on a computer
- Not Rehearing Behavioral Questions
- Not Doing a Mock Interview
- Trying to Memorize Solutions
- Not Solving Problems Out Loud
- Rushing
- Sloppy coding
- Not Testing
- Fixing MIstakes Carelessly
- Giving up
F&Q
- Should I tell my interviewer if I know a question?
yes- What languages should I use?
java>c++- I didn’t hear back immediately after my interview. Am I rejected?
No. Always follow up.- Can I re-apply to a company after getting rejected?
Yes, but typically have to wait a bit(6 months ~ 1 year).
Technical Questions
Five Algorithm Approaches
- Examplify :举一个特殊的例子
- Pattern Matching:找一个相似的模式
- Simplify and Generalize:把问题简化成一个简单形式
- Base Case and Build:如果n=1,n=2正确,可以推出n=3正确,我们可以一直推展到如果N-1正确,那么N正确
- Data Structure Brainstorm:首先你要了解各个数据结构的性质
What Good Coding Looks Like
General properties:
- Correct
- Efficient in terms of both time and space. This “efficiency” includes both the asymptotic (big-O) efficiency and the practical.
- Simple
- Readable
- Maintainable
Use Data Structure Generously
要敢于创建自己的数据结构使得代码变得更优化Appropriate Code Reuse
尽量让代码可以重复的利用,以方便维护Modular
让代码的不同功能模块在不同的函数中实现可以让测试变得更加容易Flexible and Robust
尽量让代码的具有更广泛的适用性,不要局限于某个特例。e.g. n=N 就要好过 n=3。尽量用template或generics来实现。
如果general case的复杂性过大,那还是选择特例比较好。Error Checking
如果实现error checking比较简单(simple if-statement)那么可以直接去实现。如果相对复杂,那么就要留下足够的空位并告诉interviewer你会在之后实现它。