5 Tips for How to Succeed in Coding Interviews
I conducted a few coding interviews recently. I wasn't asking a very difficult question. But still, many candidates failed to do well. Irrespective of the job level you are applying for, coding is expected to be your core competency. So you have to do better in coding interviews to succeed.
I have interviewed for >20 top companies and I have taken >100 interviews of candidates from different companies. Based on my experiences on both sides of the table, I have some tips that you may find helpful in coding interviews -
1. Seek Clarity
This is the most common mistake. Often, there are always missing bits of information in the question statement. After the interviewer presents the question, you should ask follow-up questions, clarify edge cases, and state assumptions. You shouldn't proceed until you are clear about the problem statement.
2. Think before you implement
After you are clear about the problem statement, you should try to propose all possible solutions you can think of, even brute force. Evaluate their trade-offs. Discuss with the interviewer about the final solution to implement.
3. Write code like a pro
Nowadays, interviewers ask you to write code in the language and environment of your choice. Be wary of time when you implement code and use all sorts of IDE functionality - auto-generate getter/setter functions, classes, functions, renaming, debugging, etc to speed up your work.
4. Create solutions incrementally
I have seen many developers trying to write the entire solution at once and then struggle to make it run in the end. For a given set of requirements, start with a minimum subset and then add functionality incrementally.
5. Prove it works
It's very important to make sure the interviewer sees your code works. Write small test-like functions to cover different use cases. Without that, it's hard for the interviewer to judge its correctness.
And finally, remember that the interviewer is actually like your advocate in the final debriefs. And it's your responsibility to make his/her job easy. So during interviews, share your thoughts and write notes/comments. This way, in case of close calls, if the interviewer panel revisits the final artefact, they can draw more signals from it.