Ace the coding interview, every time

Technical Preparation

Assumptions

First and foremost, you already know how to code. You may or may not have a CS background — this is OK, but you’re already a good coder, you just need a CS refresher, and a game plan for interview day.

How long do I need to prepare?

Your mileage may vary, but in general, at least 4–6 weeks, for 2–3 hours a day, and this assumes you are an experienced Engineer with a strong background in Computer Science. Move the time slider out according to your experience level.

The Basics

First, the good news. Virtually all software companies, especially the large ones, use the same interview process (in many cases to a great degree of similarity). We won’t cover the process here, but these 3 blog posts cover what you should expect to encounter in 90% or more of your technical interviews at most companies:

  1. “Get that job at Google” — Steve Yegge. The original article, and by far the best reference on the topic
  2. “Get that job at Facebook” — Carlos Bueno
  3. “Get that job at Microsoft” — Nick Ciubotariu (shameless plug)

What to Study

First, the absolute must-haves, in order:

  1. Trees (especially Binary Search Trees)
  2. Trees (especially Binary Search Trees) — again
  3. Big O Notation
  4. Hash Tables
  5. Object Oriented Design/Systems Design
  6. Algorithms: Breadth First Search/Depth First Search, Binary Search, Merge Sort and Quick Sort
  1. Arrays
  2. Recursion
  3. Linked Lists
  4. Stacks/Queues
  5. Bit Manipulation

Mock interview guidelines

Use a white board, or better yet, pencil and paper. Follow this rule, and you’ll be successful. Violate it at your own peril.

Eat the elephant one bite at a time (how to study)

The topic of computer science is, by its very own nature, very dense, and the subject matter can be hard to digest. Pick a particular area, increasing the difficulty as you go, and try to solve 2–3 coding questions per day. Anymore than this, and you may start to lose your drive to study, begin skipping days, etc., and a good study plan will immediately unravel.

The week before the interview

If you followed the blueprint above, you’re not cramming this week. You may be reviewing study material, but mostly you’re doing additional research on the company you’re interviewing with, the team, culture fit, and position in general. You already put in the study sweat equity. Use this week to spend the time polishing other areas of the interview, such as soft skills, specific technology topics, etc.

The day/night before the interview

Rule #1: get a good night’s sleep!! Nothing is more important than being at your best for what promises to be a very exhaustive day of programming acrobatics. You’ve done your homework and you’re ready — have confidence in yourself and the hard work and prep time you’ve put in to get here!

No, no and no ☺

Do not interview while you’re sick!! It’s not only not good for your own personal sake of well being, no one wants you there to get them sick! I admit to having done this once — I was on the verge of pneumonia, and my interviews had to be halted and I had to be helped out of the building as I was about to pass out from dehydration. Thankfully, I interviewed with a very understanding and courteous company who offered me another chance to come on campus and interview once I was healthy again.

The day of the interview

Be on time and bring a bottle of water (I prefer Gatorade for energy). Most companies will offer you refreshments, but have something handy just in case.

  • What type of list are we discussing? “A linked list”
  • Is this a singly-linked list or doubly-linked list? “Singly-linked list”
  • Is space complexity important? “No, but time complexity is”
  • In that case, is a recursive solution acceptable? “Yes, but it would be nice to see an iterative solution as well if we have time”
  • Do you want me to code the helper Node class? “No, you can assume you have int data and Node next”

What to do if you’re stuck

Always solve the problem algorithmically first. If your algorithm is solid, coding it will be easy. If you get stuck on coding, code your skeleton functions and get the nullcheck/termination clauses and other test cases out of the way to start getting code flowing in the right direction (or at least getting some code on the whiteboard).

Additional pointers

Use the whiteboard judiciously. Start at the top left and work your way down, then right. Write as legibly as possible. Clearly separate pseudo-code from real code. Use generally-accepted coding conventions (in Java, for instance, method names have mixed case letters, beginning with a lower case letter and starting each subsequent word with an upper case letter). Make sure your parentheses and brackets are balanced, and you’re not missing a sea of semicolons in your functions. Stay away from one letter variable names if possible; of course, this excludes loop constructs (int i, j) and try/catch blocks (exception e). Loop counters always start with i for index.

Study Guides

(for clarity, I have no affiliation with anyone or anything I will recommend in this article, and will receive zero compensation for the recommendations I make). These are, in my opinion, just great resources to help you along the way.

  1. Cracking the Coding Interview: 150 Programming Questions and Solutions — to date, there is not a better book out there for technical interview preparation
  1. My Code School — One of the best resources I have found that comprehensively covers data structures, algorithms and CS concepts in general. Best of all, it’s free!
  2. Udemy — Data Structures and Algorithms. — For those unfamiliar, or those that need a good refresher. There is a cost for this course ($49)
  1. Leetcode — With over 150 questions and counting, this should be your absolute first destination for practicing programming questions and code katas.
  1. GeeksforGeeks — everything but the kitchen sink is here ☺, including a very nice “interview corner” section, and countless programming questions
  2. careercup — Developed by the author of “Cracking the Coding Interview”, this site remains an invaluable resource to everyone looking to improve their technical interview skills

Improve and maintain, over time

Once the rust is gone, and you’re fully prepped, it is dead easy to keep your CS and interview skills sharp: solve one coding question per day. I’ve been doing this for the past 3 years or so, and I’ve realized the following benefits:

  1. I’m never out of practice
  2. It helps flex mental muscles and improve critical thinking, the same way solving crossword puzzles, brain teasers or playing a game of chess might.

--

--

http://linkd.in/1tKpzQB

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store