General Tips

Always bring up the naive solution

The naive solution may seem useless to mention at first glance. But proposing the naive solution has positive qualities. It first shows that you understand the problem and expected output.

The next quality is that it may actually be more than enough for what the interviewer is looking for. You’ll show how well you communicate and explain the trade-os of this solution. Don’t push yourself to solve a harder problem.

Finally, the naive solution gives you something to work o of. The naive solution is a base that can slowly be improved by focusing on the bottleneck. If you’re able to explain to your interviewer why it’s dicult to improve that area, they’ll be more likely to help you without penalty.

Use Helper functions and clean variable names

The cleaner and more structured your code is, the easier it will be to debug it. Instead of looking at a long spaghetti list of code, you’ll be able to focus on a helper function that isn’t working as intended or a for-loop that isn’t processing data as expected. Cleaner names will make dry running your code easier and help you explain out loud to the interviewer.

Dry run your code, dry run you code often

Dry running your code after implementing a large portion of your algorithm will help you identify bugs as soon as possible. If what you’ve written is already complex, writing more will make your code even more complex. Fix complicated and incorrect areas of your code. You’ll be more likely to have a more complete and correct implementation.

Ask the interviewer what they want you to do next

Every interviewer is different and wants you to do different things. The easiest way to figure out what they want you to do is to simply ask. After implementing your algorithm, do they want you to optimise it or dry run it against a test case? Do they want you to talk about trade-os or explore edge cases? Always leave it up to your interviewer to tell you what they want you to do next. You can always do that by offering “Would you rather have me dry run my code or optimise it even further?”

Last updated