Problem Solving Fundamentals · Approaching a Problem

Recognise a pattern you know

pattern recognition

Recognise a pattern you know

A chess player does not work out every opening from first principles. They see the first few moves and think "ah, this is the Sicilian" — a shape they have met before, with ideas that follow from it. Then they play those ideas, not a blank board.

Most problems are like that. You have already solved their shape somewhere; you have not noticed yet.

Here is a task that sounds new: "find the topic an article keeps returning to." Read the words, and the ask is really "which word appears most often" — and you have met that shape. It is a frequency count:

const counts = {};
for (const word of words) {
  counts[word] = (counts[word] || 0) + 1;
}

Build the tally first. Once you have it, finding the largest is a second, smaller step. The unfamiliar task was two familiar ones stacked.

Four shapes cover a lot of ground. A transform turns every item into a new item. A filter keeps some items and drops the rest. An accumulate folds a list down to a single value. A frequency count gives each value a tally. When a problem feels strange, ask which of these it is wearing.

You are about to answer a short quiz on recognising known patterns.

  1. Recognising a known pattern lets you map an unfamiliar problem onto a shape you have already solved.
  2. Turning every item in a list into a new item is called a ___.
  3. Keeping some items and dropping the rest is a filter.
  4. Folding a list down to a single value is called an ___.
  5. Giving each distinct value its own tally is a frequency count.
  6. When a problem feels strange, ask which known ___ it is wearing.