Jc-alt logo
jc
Textbook: Cracking the Coding Interview

Textbook: Cracking the Coding Interview

··
8 min read
·interviews

Cracking the Coding Interview

Preparing for technical interviews

1. The Interview Process ::Pg.4::

1.1 What

Most top tech companies and the many other companies that copy them use algorithm and coding problems to as the largest component of the interview process.

These boil down to problem solving questions testing the candidates ability to solve algorithmic problems you haven't seen before. This aims to assess based on the following categories:

  1. Analytical Skills:

    • Optimal solution
    • How much help/hints were needed
    • How long it took
    • etc.
  2. Coding Skills:

    • Translating algorithm to code
    • Considering Tradeoffs
    • Followup to design/architect a new solution
    • etc
  3. Technical Knowledge / Computer Science Fundamentals:

    • Strong fundamentals
    • etc
  4. Experience:

    • Good technical decisions in past
    • Built interesting
    • Challenging projects
    • etc
  5. Culture fit / Communication skills:

    • Personality and values
    • Fit with the company
    • etc

1.2 Why?

Because its better than nothing. Companies need some way to filter the thousands of candidates per position. No point in complaining, just study and prepare for the interviews.

1.3 How Questions are Selected

Some companies have their own internal question banks, some use public question banks, and some use a combination of both.

Prepare for both cases:

  • Current up to date company question
  • Popular and important leetcode questions

1.4 Its All Relative

For a specific question, an interviewer is simply comparing you to other candidates:

  • candidate 1: 30 mins to solve
  • candidate 2: 50 mins to solve
  • candidate 3: 15 mins to solve but many hints
  • candidate 4: 10 mins with an alternate approach

A hard question thus isn't a bad thing. When its harder for you, its harder for everyone else as well. An interviewer is simply getting a feel for you performance relative to all other candidates they have ever asked this question to.

1.5 Frequently Asked Questions

No answer, rejection? If you haven't heard in 3-5 business days, check in with the recruiter, else move on.

Reapplying? Yes, but typically have to wait 6 months to a year.

2. Behind the Scenes ::Pg.8::

2.1 A Repeat Curtain

Most companies conduct their interviews in similar wars:

Round 1. 2x Screening Interviews

  • coding and algorithms questions
  • bar can be just as high as onsite interviews

Round 2. Onsite 4x-6x Interviews

  • the standard technical interview

Round 3. Lunch Interview

  • non technical
  • discuss interests
  • opportunity to discuss company culture

Round 4. After Interview Feedback

  • performance
  • feedback
  • decision

2.2 Per Company Basis

Excluded this for now

3. Situations

3.1 Experienced Candidates

More experienced engineers might see less algorithm focused questions or be held to a lower standard as its been a few years since they took an algorithms class.

Or on the other hand, they might be held to a higher standard as more years of experience allow a candidate to see more problems.

Either way, it balances out.

System design is the exception where its more for experienced engineers since design is something that is usually not covered in university.

3.2 - 3.6

Not applicable to me.

3.7 For Interviewers

Good to think about being on the other side so chose to include this:

Ask Medium And Hard Problems:

  • If a question is too easy, candidate performance gets clustered together

Look For Questions With Multiple Hurdles:

  • Some questions have a single "Aha!" moment which require a specific insight
  • A series of hurdles, insights, or optimizations are better than a single insight
  • If a single hint makes a substantial difference in a candidates performance, then its usually not a good question

Use Hard Questions, Not Hard Knowledge:

  • Most cs graduates understand trees but may not remember dijkstras algorithm
  • Check if knowledge you are testing is an important skill

Avoid "Scary" Questions:

  • Some types of questions intimidate candidates because it seems they involve specialized knowledge (even though usually they don't)
  • Math or probability, low-level knowledge, system design or scalability, etc

Offer Positive Reinforcement

  • Many candidates are intimidated by interviewing and try to read into the interviewer's every word.
  • You want a candidate to feel comfortable as a nervous candidate will perform poorly
  • Try to be warm and friendly to your candidate

Probe Deeper On Behavioral Questions

  • Many candidates are poor at articulating their specific accomplishments
  • Usually you ask them about a challenging situation, and they tell you about a difficult situation their team faced, and as far as your can tell they didn't really do much.
  • Not describing the details of the actions they took make them a flawed candidate, but not necessarily a flawed employee.

Coach Your Candidates

  • Many candidates don't use a good example to solve an interview questions
  • Some candidates take a long time to find a bug because they use an enormous example
  • If they dive into code before finishing planning the optimal solution, pull them back and have them focus on the algorithm
  • If they get nervous and stuck, suggest that they walk through the brute force solution, as their first solution doesn't have to be perfect

If They Want Silence, Give Them Silence

  • Learn to distinguish between "I'm stuck" and "I'm thinking in silence"

4 Types Of Questions

Sanity Check

  • Easy problem solving or design questions.
  • Assess minimum degree of competence to filter out the worst candidates

Quality Check

  • More challenging, again problem solving or design
  • Make a candidate think

Specialist Questions

  • Test specific tops such as Java or machine learning
  • Used for skills even a good engineer can't learn quickly on the job

Proxy Knowledge

  • Knowledge that is not quite at the specialist level
  • But if a candidate has worked in depth with these technologies and can't tell you why a specific choice is good or bad, that suggests and issue that they are not absorbing information core to their job

4. Before the Interview

4.1 Getting The Right Experience

4.2 Writing a Great Resume

4.3 Preparation Map

5. Behavioral Questions

5.1 Interview Preparation Grid

5.2 Know Your Technical Projects

5.3 responding to Behavioral Questions

5.4 So Tell Me About Yourself

6. Big O

6.1 An Analogy

6.2 Time Complexity

6.3 Space Complexity

6.4 Drop the Constants

6.5 Drop the Non Dominant Terms

6.6 Multi Part Algorithms: Add vs Multiply

6.7 Amortized Time

6.8 Log N Runtimes

6.9 Recursive Runtimes

6.10 Examples and Exercises

7. Technical Questions

7.1 How to Prepare

7.2 What You Need To Know

7.3 Walking Through a Problem

7.4 Optimize & Solve Technique 1: Look for BUD

7.5 Optimize & Solve Technique 2: DIY

7.6 Optimize & Solve Technique 3: Simplify and Generalize

7.7 Optimize & Solve Technique 4: Base Case and Build

7.8 Optimize & Solve Technique 5: Data Structure Brainstorm

7.9 Best Conceivable Runtime (BCR)

7.10 Handling Incorrect Answers

7.11 When You've Heard a Question Before

7.12 The Perfect Language for Interviews

7.13 What Good Coding Looks Like

7.14 Don't Give Up!

8. The Offer and Beyond

8.1 Handling Offers and Rejection

8.2 Evaluating the Offer

8.3 Negotiation

8.4 On the Job

9. Interview Questions

9.1 Data Structures

9.2 Concepts and Algorithms

9.3 Knowledge Based

9.4 Additional Review Problems

10. Solutions

10.1 Data Structures

10.2 Concepts and Algorithms

10.3 Knowledge Based

10.4 Additional Review Problems

11. Advanced Topics

11.1 Useful Math

11.2 Topological Sort

11.3 Dijkstras Algorithm

11.4 Hash Table Collision Resolution

11.6 AVL Trees

11.7 Red Black Trees

11.8 MapReduce

11.9 Additional Studying

12. Code Library

12.1 HashMapList(T,E)

12.2 TreeNode (Binary Search Tree)

12.3 LinkedListNode (Linked List)

12.4 Trie & TrieNode

13. Hints

13.1 Hints for Data Structures

13.2 Hints for Concepts and Algorithms

13.3 Hints for Knowledge Based

13.4 Hints for Additional Review Problems

14. About the Author