Coding Interviewing Tips from a random CS Dude
A compilation of coding interview tips I’ve given as a tutor/mentor/course facilitator. Will update as I get time to put more tips together!
- When starting your interview prep journey, try to not look at answers — struggle through it and force yourself to think of different ways to get unstuck. Focus on your problem solving skills at this stage.
- Once you’ve done a lot of practice, shift your focus to getting exposure to a breadth of questions. At this stage, it’s more about seeing as many interesting edge cases and techniques as possible, which can build up your toolbox to pull from and find inspiration from.
- As you do practice problems, keep a running list of the common mistakes that you make. Keep reviewing this list and make sure you’re learning from past mistakes to actually grow from the practice problems.
- Try to do as many mock interviews as possible (both as the interviewee and as the interviewer). Getting practice as the interviewee is obvious, but hopping into the interviewer’s shoes is a great way of seeing what interviewers are looking for, what they’re thinking during the interview, the types of hints they they can give, etc… Mock interviewing others helped me get over interview anxiety and helped me learn how to make the interview itself an enjoyable experience. (More ways on how to find mock interview partners in Additional Resources.)
During the interview
- Ask clarifying questions. Bring up any edge cases you can think of at this point!
- Always go for the brute force solution first. Better to have something than nothing. Also sets a baseline for further optimizations.
- Don’t jump right into the coding. Talk through the brute force → explain time/space complexities → if it’s possible, mention that you think you can do better in one or the either (or both) → ask if the interviewer wants you to explore optimizations. Sometimes they’ll just want you to start coding the brute force.
- Think of your interviewer as your coworker. You’re both working together to solve a problem. Your interviewer isn’t there to see you fail; they also want to see you succeed. Approaching the interview in this manner helps make the conversation flow more naturally.
- Think aloud. This helps the interviewer know which direction you’re going in. They’ll be better able to give you a hint or course correct when necessary.
- Help your interviewer guide you. This involves prompting them to help you in a strategic way, e.g. “I’m thinking x, what do you think?” or “I see two different approaches, x and y. X is better because of this, is it fine for me to explore that a bit more?”.
- Never say “I’m done” after finishing the last line of code. You don’t want to send a signal that you’re a careless and hasty coder. Ask the interviewer if you can go walk through the code one last time to double check. As you’re doing this, briefly explain what each line of code is doing, both to help yourself check for correctness but also to explain the approach once more to the interviewer. After the walkthrough, you can also go through test case(s) depending on how much time is left and the complexity of the code.
Ending the interview off on a positive note
- Have one or two solid questions to ask the interviewer!
- Pramp.com — Mock interviews (1 hour as interviewee, 1 hour as interviewer). Good for getting into interviewer’s shoes/getting over interview anxiety.
- Interviewing.io — Mock interviews with engineers from top companies.
- Cracking the Coding Interview — The book that almost every CS student has used to prep for interviews (or has sitting on their desk). Good for getting a quick overview/summary on popular interview topics.
- Leetcode — Yep.
- Intern.supply — Huge list of tech internships/applications.