↚ all drops

How to solve any coding challenge (Part 2)

Newbies get a rough deal

One of the things required to be understood for the successful implementation of coding challenges is something called algorithms. An algorithm is simply a step-by-step procedure, which defines a set of instructions to be executed in a certain order to get a desired output. Some tutorials use the example of the sequence of activities you do to get ready to leave the house for work, or school. Some present the analogy of following a cooking recipe, or assemblying an Ikea purchase. The problem with that approach is it doesn't actually prepare the candidate for what to do when faced by the requested task on the occasion.

I mean, how do you use the knowledge of following a cooking recipe to solve a task such as: "Reverse every K-element sub-list"?

Understand the tools

That's what you actually use in solving coding challenges. Tools. And understanding tools isn't just about understanding what the tools are, or how they operate, but also when to use them and on what. If a carpenter tells me about a hammer, without helping me realise exactly the types of activities that the hammer is useful for, I may find myself using that hammer to try and unscrew something. So, understanding the tools and in what circumstances to employ them is an important part of the process. When the candidate understands that, the candidate can understand the big picture. When the candidate understands the big picture, the candidate can determine which tool or technique to employ in solving a particular coding challenge.

Understand Algorithmic Techniques

There are a number of techniques to be used for certain coding problems:

  1. Sliding Window technique
  2. Matrix Traversal
  3. Two Pointers technique
  4. Fast & Slow Pointer technique
  5. Merge Intervals technique
  6. Cyclic Sort technique
  7. Breadth-First Search technique
  8. Depth-First Search technique
  9. In-place Reversal technique

These are just some of the techniques that can be used to solve particular coding challenges. Understanding them, and identifying which problems they help solve would be the topic of our Part 3 article.