Published on

My Strategy & Thought Process for Coding Interviews

Authors

Introduction

From experience, during the technical interview process there is always the whiteboard or code pad coding interview. Given a 45-minute time restraint to explain your thought process and attempt to solve the problem in code or pseudo code as best as you can may seem intimidating. However, working through a coding problem with the interviewer can help showcase a candidate's problem solving skills and communication skills by walking through your though process along with your interviewer.

Breakdown

Assuming there is 45 minutes in the interview, I developed a strategy to frame out my thought process during a coding interview

1. Understanding the Problem (5 minutes)

Read the problem carefully, reread it once more just to see if you notice any parts you didn't understand which I recommend to clarify with your interviewer if you do. Next, I would repeat the problem in my own words just to double-check my understanding of the problem while visualizing my own approach. Finally, validate any assumptions you have with your interviewer to ensure you have the right scope before tackling the problem head on.

2. Problem Solving (10-15 minutes)

Before you just throw your brain at the keyboard and start writing code, it is wise to come up with an optimal strategy on how to solve the problem.

These are a few problem solving strategies:

  1. Come up with a brute force or naive approach to the problem and iterate starting from there while optimizing for time and space complexity.
  2. Divide and conquer, by breaking down a problem into a smaller subset of problems and solving them individually.
  3. Data structures and algorithms patterns matching like sets, dictionaries, maps, and hash maps can be applicable to multiple problems. See if you notice a pattern matching the problem with common data structures or algorithms if they can be applicable to the problem.
  4. Write out pseudocode, an informal high-level description of what your algorithm or program will do. Writing pseudocode out will help you to stay on track with the problem when you move on to actual code.

3. Coding (20 minutes)

Now before you begin to code, you would want to clarify with your interviewer for any questions like if you can utilize libraries and look up library constructs, and also get to know the platform or coding environment you are given because you would want to know how to run your code while solving the problem.

While you code:

  1. Talk out loud when you're explaining what you're doing as you code. Interviewers want to be able to hear your thought process because when you are explaining and they are following along they have the opportunity to assist you during the interview.

  2. Test your code early on and at every step of the way you can to prevent a tricky debugging session at the end of the interview.

  3. Stay on track by referring to your notes and strategies from the problem solving step throughout the coding process.

4. Double Check & Review (5 minutes)

  1. Test: Review the test cases and edge cases of the problem, ensure they are tested and handled properly.
  2. Optimize: Look for ways to optimize your code in both speed and memory.
  3. Clean Up: Refactoring code and code structure to tidy up and improve on final touches.

There it is! My framework for tackling whiteboard coding interviews. Let me know if this was of any help and anything I can improve on, and if I may ask, what kind of tips do you have for coding interviews? What's your coding interview strategy?