How to Approach Algorithms

Algorithms can feel like a difficult beast to approach, however, breaking it down into manageable steps can keep the stress from elevating too high!

Step 1: Rephrasing the problem: clarify the requirements and parse out important information

Before starting the problem, it can be helpful to clarify any constraints and details. Edge cases, non-testable cases, constraints, etc.

Step 2: Come up with simple test cases for the algorithmic problem

The reasoning behind this step is that sometimes it can be easy to overcomplicate the problem, but by simplifying the test case to a simpler form, the extraneous nuances and algorithmic complications are removed, thus leaving you with the core problem and algorithmic approach

Step 3: Think of the data structure you want to use

During your code challenge, the data structure you use can help improve the run time and memory space used. By optimizing the data structure, the quality of your solution can improve drastically.

Step 4: Write in pseudocode

In the beginning, it can be difficult to explain your solution while writing the code, so if you’re still new to algorithms, pseudocode allows you to see the big picture algorithm you’re trying to implement. Additionally, as you build your pseudocode, it’s possible that your technical interviewer will ask questions or give hints and suggestions to help guide you, so take the time to write things out in pseudocode!

Step 5: Code

With all the heavy lifting of creating an algorithmic solution done, you can code out the solution and hopefully with less stress — good luck on interviews everyone!



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store