← Blog

Getting Started with Problem Solving

The Mindset Shift

When I first started competing in math olympiads, I thought the goal was to find the answer. It took me years to realise the goal is to understand the structure of the problem. Once you understand the structure, the answer follows almost naturally.

This same principle applies everywhere — debugging a production outage, designing a data model, writing a difficult email. The people who solve things fastest are rarely the ones who jump to solutions first. They're the ones who slow down to understand the problem.

A Framework That Actually Works

Here's the rough process I've settled into:

  1. Restate the problem in your own words. If you can't do this clearly, you don't understand it yet.
  2. Identify what you know and what you don't. List the constraints explicitly.
  3. Look for simpler versions. Can you solve it with N=1? With one variable fixed? With the edge case removed?
  4. Work backwards from the desired outcome. What would need to be true for the solution to work?
  5. Execute, then verify. Don't just check that your answer passes the given cases — check that it handles the ones you thought of in step 2.

What This Looks Like in Code

Here's a simple example in TypeScript. Suppose you need to find all pairs in an array that sum to a target:

function findPairs(nums: number[], target: number): [number, number][] {
  const seen = new Set<number>();
  const pairs: [number, number][] = [];

  for (const num of nums) {
    const complement = target - num;
    if (seen.has(complement)) {
      pairs.push([complement, num]);
    }
    seen.add(num);
  }

  return pairs;
}

The naive approach is O(n²). The systematic approach — "what do I need to know at each step?" — leads you naturally to the hash-set solution in O(n).

The Long Game

Problem solving is a skill. Skills degrade without practice and compound with deliberate effort. The best investment I've made is keeping a log of interesting problems I've encountered — not just the solutions, but the reasoning paths I took, including the wrong turns.

If you're starting out: pick hard problems, fail often, and pay attention to why you fail. That's the curriculum.

Stay in the loop

Get new posts delivered to your inbox.

Leave a comment