How to Nail Your Next Coding Interview
The room is silent except for the buzzing of the fluorescent lights. The judges across the table are staring at you, expressionless. Some have pen and paper, some don't. They're all staring at you. Your mouth is so dry it feels like you've been eating sawdust all day. You grab the marker and head for the whiteboard. One judge is staring at a laptop. It's time to show them a quicksort.
I've been on both sides of the coding interview. I've interviewed for jobs, sometimes I got the offer, sometimes I didn't. Sometimes I nailed the whiteboard tests and didn't get a call, and vice versa. I've interviewed probably hundreds of people in my career and I did my best to make candidates feel comfortable, but many managers won't. They will try to trip you up, make you choke. We can argue about the effectiveness of a whiteboard interview later, but they will happen.
Let's look at some tips to rock your next coding interview. You can set yourself up for success and nail it. Don't be mistaken, this isn't a set of "hacks", "tricks", or some kind of brain dump. Don't use sneaky tactics or tricks to crack your way into a position you aren't qualified for. They'll just fire you later. Follow this path and you will nail the interview because you'll be a better developer.
What They're Looking for
Here's what most of the interviewers will be looking for, in no particular order:
Problem Solving - How well can you solve problems, and more importantly: what is your process. Many tests will look for this.
Coding Skills - You'll need to be ruthlessly good here. I've handed people laptops and told them to write something for me. You can tell how much actual coding people have done by watching them do it.
Technical Knowledge - This is where the trivia questions come in, but your interviewer wants to know just how technical you are.
Experience - This is where you talk about your past projects. Interviewers want to hear your war stories, and what you learned from them.
Culture Fit - I can't help you much with this one. This is where they see how you'll fit into a team. There are ways you can improve in this area.
So what do you need to do to get prepared? Let's dive in.
Stage 1: Laying the Foundation
So here's what you need to be doing way before any interview. Days, months or weeks before you need to build some core skills.
Learn Computer Science Basics
You need to get the basics of Computer Science down. You don't have to be Donald Knuth here, but you need to know the theory, language, and idioms. This is the bare minimum for an interview. If an interviewer starts casually mentioning a binary tree in the interview you better know what they're talking about.
- Review The Basics of Computer Science Tutorial - some of this may be pretty basic to you but it gives you a framework of things to pay attention to. Where do your strengths lie? If you find any areas where you are weak at, work to build your knowledge and skills in that area.
- Review Teach Yourself Computer Science - Again we're talking basics foundational stuff that you may be lacking in. You need to know the basics and speak the language.
- You can even take a course on Computer Science 101 from Stanford, for free.
Learn Different Algorithms
Algorithms run the world and if you're a developer you'll need to know them. So how do you get good at algorithms? It's not black magic or a secret art.
According to Geeks for Geeks these are the top 10 algorithms in interview questions:
- Graph
- Linked List
- Dynamic Programming
- Sorting and Searching
- Tree / Binary Search Tree
- Number Theory
- BIT Manipulation
- String / Array
It seems pretty accurate to me. It's super helpful to know this. What are you great at in this list? What are you weak at? This link is excellent for getting a high-level view of each and some examples.
These courses will help you absolutely dominate in this area:
In about 6 hours you'll be able to understand and really talk the talk when it comes to algorithms.
Action: Study this stuff. Learn it. Know it.
Stage 2: Practice Practice Practice
Here's another thing you need to make a part of your routine: practice. You need to practice this stuff a few times a week or more to really get good.
The more you practice the better you'll do in any whiteboard situation. Most of the time they ask for pseudocode but if you really put your practice in you can write real compilable code on a whiteboard without blinking.
- Check out the HackerRank Interview Preparation Kit - This is where the rubber meets the road with all that algorithm knowledge you now have. Put it to work with real examples.
- Start participating in HackerRank Challenges - This is how you can really apply your knowledge in different areas. This is the ultimate whiteboard practice area.
It's broken down like this:
Do an exercise a day when you can. Work your way through many of the challenges. If you just do a challenge a day for 30 days you can nail a whiteboard interview and will become a better coder. I promise you.
- Sign up for LeetCode and start participating in challenges - Nothing sharpens your skills like competing with others. There are tons of challenges and fun stuff here.
- Check out Project Euler and start writing code to solve the problems there. Project Euler is a set of math and programming problems that really challenge your problem-solving abilities. Use code to solve your problems here and your skills will grow.
Action: Write some code. A lot of it. Get ruthlessly good at it.
Stage 3: Build Your Public Profile
You need to have work you've done online and accessible. Every recruiter, manager, or someone interested in you will Google you. Make sure they find your work.
- Put your stuff Online and start a GitHub account if you don't already have one. Put all of your code up there. Your personal projects, stuff you write for tutorials, all of it.
- Create accounts on sites like JSFiddle and CodePen - This is mostly for web developers but it creates a good spot where people can find your work.
- Create a Blog - It doesn't matter if it's WordPress, GitHub pages, or a custom hosted server setup like my blog you should create a blog that talks about what you're working on, what you're learning, and what you can teach.
Note: I have thrown away resumes of people when I couldn't find their GitHub or any public work. This shows that they aren't enthusiastic and managers who look for passionate people will look for what you've posted publicly.
Put your work out there no matter how good it is.
Action: Sign up and start making your code and projects public.
Stage 4: Prepare for Interviews
Preparation ultimately determines your success. Nobody succeeds without preparation. Here's how you can prepare for your interview and kick the ball through the uprights.
- Pick up a copy of Cracking the Code Interview - This book is the bible of coding interviews. Like this article it doesn't tell you how to cheat or shortcut your way into getting hired - it gives you a great framework to upgrade your skills. Practice questions are included and it gives you all the tools you need to really sharpen your skillset.
- Take this Course on preparing for a job interview - This gives you the information you need to really prepare yourself.
- This course covers:
- Job Interview Basics
- Algorithm-based Questions
- Typical Questions
- Computer Science Questions
- Getting Experience It really covers what you need to know to succeed in 2 1/2 hours. Well worth it.
Exercise - Ok I know this will sound silly, but here's something that will give you an extra edge. No matter what time of day your interview is hit the gym or do some cardio an hour or two before the interview.
This will ensure:
- You are refreshed and energetic
- You have oxygen flowing through your blood
- Your muscles will be relaxed
A good hard workout will make sure you are charged and ready to go for your interview. You don't want to seem tired or lethargic in your interview. You want to be at your physical and mental BEST.
Preparation is everything. The more you prepare the better you'll feel on the interview day.
Action: Start training like a boxer. Get fight ready.
Conclusion
Coding interviews can be brutal. You can take the sting off them by doing the following:
- Learning
- Sharpening your skills
- Practicing
These things will ensure your success. Trust me, after working on crazy problems in LeetCode and HackerRank the whiteboard tests are so much easier. If you do this alone, you'll be successful.
If you have comments feel free to share or yell at me on Twitter and we can discuss it.