How to approach the coding interviews and what to do step-by-step

Before

Always

  • Prepare Self-introduction and final questions

By setting

Virtual

  • Prepare pen and paper
  • Be in quiet environment with earphones
  • Check your setup - internet, webcam, audio
  • Prepare environment (coderPad/codePen)

Phone

  • put the phone down and use earphones
  • Check the setup
  • request for virtual interview instead, if possible

During the Interview

1. Introduce yourself

Take about a minute

2. Understand and clarify the question

  1. Paraphrase and repeat the question to the interviewer
  2. Clarify assumptions
    • Can you modify the original structure?
    • How is the input/data stored
    • A dictionary of words is a list of strings or a Trie
    • Is the input sorted
  3. Clarify inputs
    • what’s the range?
    • what’s the format?
  4. Talk through an example
    come up with simple cases to ensure the understanding and ask if they are in line with interviewer’s expectations

3. Create and optimize a solution

  • Use Coding Interview Techniques
  • Explain different approaches (at a high level) and discuss the trade-offs
  • Talk about time/space complexity in big O notation
  • Listen to any remarks from the interviewer
  • Agree on the best approach and optimize it
  • Wait for interviewer signal to start coding

4. Code the solution

  • Explain what you’re doing as you’re writing
    • compare different approaches where relevant
  • Write working code wherever possible, not pseudocode
  • Write clean, simple and correct code
  • Use clear names
  • Ask for permission to use trivial functions without implementing them
  • Write modular code, from high-level to low level
  • State where you would do things differently in other circumstances

5. Finishing coding

  • Scan code for mistakes
  • Look for edge cases
  • step through edge cases
  • Look for possible refactoring
  • Reiterate space and time complexity
  • Explain trade-offs and how the approach can be improved if given more time

6. Ending

  • Ask good final questions, tailored to the company
  • thank the interviewer

7. Later

  • Record the interview questions and answers
  • Send a follow up email/LinkedIn invitation to interviewer(s) thanking them for their time and opportunity to interview

Sources

Coding Interviews

General