Mastering Live Coding
Does the idea of coding on a whiteboard, away from your IDE, in front of a seasoned programmer leave you shaking in your boots? We’ve got you covered with these tips and tricks on getting through the coding section of a technical interview.
Hiring managers are looking at more than your ability to produce well-written code in an efficient amount of time. They are also assessing how you handle ambiguity, your analytical skills, your ability to stay calm under pressure, and even how well you work with a team. First and foremost, get away from your computer, grab a pen and paper, and practice, practice, practice! Resources such as Cracking the Coding Interview, Hackerrank.com, Pramp.com and InterviewCake.com, are great for getting practice problems. While you are studying, as well as in the interview, follow these 5 tips and soon you’ll be rocking the technical interview like a pro:
1. Ask Clarifying Questions First
Hiring managers want to know: are you the kind of person who dives in without all the necessary information? Will you spend hours on a project only to find out your solution didn’t solve the actual problem? Technical questions, especially live coding questions, are usually purposefully ambiguous. They want to see if you gather more information so you can account for constraints and potential pitfalls before spending valuable time coding a solution.
If you can’t come up with a clarifying question, look at the constraints of the problem first. Does it say what type of data you are working with? Is it always integers or can it be strings? What happens if the data set is null?
2. Talk Out Your Logic
Before diving head first into the weeds, briefly explain how you plan to solve the problem to your interviewer and write out a few comments with your strategy on the whiteboard. Once you begin to code, continue talking through your logic as you work. Pretend you are teaching a class, what would you want the teacher to share as they work through a problem on the board?
Often if your interviewer sees you are going down the wrong path, they will give you hints. If you are silent while working they won’t know you are off track. Hints aren’t necessarily a bad sign in a coding interview; they want to see how you take the hint and use it.
Hints aren’t necessarily a bad sign in a coding interview, they want to see how you take the hint and use it.
3. Comment Your Code
This is your chance to show potential employers your programming style. Let them know you follow best practices and throw some brief comments on the more complicated parts of your code. Don’t worry about being too thorough, just give them a hint that you are a person that knows to comment your code!
4. Test Your Answer
Don’t wait for them to point out your mistakes. Start with testing your code with some sample data immediately after you finish your solution. Not only is it more impressive to employers when you are someone who tests your code, it can save the day if you catch your own mistakes before they do.
Use constraints as your test sample data. Often our logic mistakes lie in the outskirts of the data range.
Use constraints as your test sample data. Often our logic mistakes lie in the outskirts of the data range. Click To Tweet
Not only is it more impressive to employers when you are someone who tests your code, it can save the day if you catch your own mistakes before they do.
5. Optimize Your Algorithm
Once you are confident you have a working solution, and not before, ask yourself (out loud) if it’s possible to make a more efficient algorithm. Remember that businesses are usually working with very large data sets and an unnecessary sort or extra loop can make a big difference in their product’s performance. If you can be greedy, or at least show employers you understand what that means, then you will win major brownie points with your interviewer.
Practice calculating the algorithmic complexity of your solutions to practice problems at home. Figure out which algorithms have a high cost and see if there’s a better way to solve your problem. If you can loop through a data set only once and never have to sort it, then do it!
What will the Coding Interview Look Like?
Know that you’re a master of the live coding interview, you might want to see what the experience is going to be like. LaunchCode has you covered: check out our coding interview video walkthrough to be sure you’re ready to crush that interview!
By Lisa Hare
Candidate Engagement Manager