20 March, 20221 minute read

The three step guide to coding interviews

For a while now I've been running a girls' competitive programming group, and one of the members shared with me her process for tackling problems. There’s a lot of overlap between competitive programming and the kind of questions you get during technical tests, so I thought I would share it:

  1. If it’s a graph problem, try depth-first search
  2. If it’s a regular problem, try binary search
  3. Otherwise, form recurrence relationship and solve with dynamic programming

That third step is a bit understated, but the gist of it is sound. If you can’t figure out a LeetCode or HackerRank problem, then you should have a list of strategies you can pull out and test. A lot of the problems you encounter are simply remixed from other problems, and it’s just a matter of pulling out the correct algorithm or data structure.

The main thing I’d add to her list is to try sorting the data and seeing whether that improves things at all. It’s surprising how often a solution presents itself once the data is ordered.

Don't want to miss out on new posts?

Join 100+ fellow engineers who subscribe for software insights, technical deep-dives, and valuable advice.

Get in touch 👋

If you're working on an innovative web or AI software product, then I'd love to hear about it. If we both see value in working together, we can move forward. And if not—we both had a nice chat and have a new connection.
Send me an email at hello@sophiabits.com