TLDR: Use a whiteboard… seriously

Do you really want to try and keep all this crap in your head?

I’ve encountered a lot of questions by people baffled about how to build their intuition when it comes to practicing algorithms. That’s ok, computer science concepts aren’t intuitive and like anything hard require practice to internalize.

The most common mistake is for people with little to moderate programming skills to fall into this deadly cycle:

  • Read programming problem in their head
  • Read it a few more times if they don’t get it
  • Start to immediately code out a solution
  • Realize they have a mental block on implementation
  • Forget what the initial problem was even asking
  • Rinse and repeat…
  • …Until they get frustrated and give up

The reason this approach rarely works (unless you are extremely proficient at problem solving) is because you are making a few critical mistakes:

  • You have not clarified your problem statement
  • You have not thought through all of your edge cases
  • You are relying on your working memory too much

The third point is the most critical because it’s where I see the most people fail (even at basic coding tasks in a work environment).

There isn’t a special prize for not writing notes down about your work, jotting down half baked ideas, backtracking etc. Next time you feel incredibly stuck try writing out your problem on a whiteboard (or easily erasable medium like an iPad). Use it to step through each cycle of your algorithm, updating things like data structures and values slowly and manually. This is what builds intuition. Be the debugger. You got this.