Skip to main content

Recognizing Problem Patterns

How to notice the shape of a problem by looking at constraints and structure instead of a mental list of tricks.

Andrews Ribeiro

Andrews Ribeiro

Founder & Engineer

The problem

Many people try to memorize a huge list of interview tricks.

Under pressure, they sometimes recognize a familiar label, but they cannot explain why it fits.

So they end up depending on weak memory instead of understanding the shape of the problem.

That usually creates two classic failures:

  • using the wrong technique because the name felt familiar
  • choosing the right technique but failing to justify it

Mental model

A pattern is not a magic shortcut.

It is a recurring shape for solving a specific structural bottleneck.

Instead of asking:

What trick solves this?

The better question is:

What kind of structure is this problem asking for?

When you change the question, you stop depending on memorization and start making a reasoned choice.

Breaking it down

First locate the main source of friction

Before you think about the technique, ask:

  • do I need fast lookup?
  • am I grouping data?
  • am I ordering it?
  • am I trying to reduce comparisons?
  • am I tracking a moving window or a running prefix?

The pattern usually starts there.

Ask what needs to be remembered

This question is very useful.

If the problem needs fast access to something that already happened, some kind of quick lookup structure often appears:

If you always need the current smallest or largest item, a heap starts to make sense.

The important part is not the label.

It is the operation you need to make cheap.

Check whether order matters

A lot of choices change because of this.

Examples:

  • can I sort without breaking the problem?
  • do I need to preserve the original index?
  • can I reprocess the data?

Ignoring that is how people apply the right technique to the wrong problem.

Do not skip the baseline

The simple baseline still matters because it exposes the real bottleneck.

Without that, people say “sliding window” or “two pointers” as if the name explained itself.

Simple example

Imagine this prompt:

Given a very large array of transactions, return true if there is a pair that sums to a target value.

A junior reaction is often to start with a double loop.

A memorized reaction is to say, “This is Two Sum.”

A more mature reaction looks at the structure:

  • I need to scan many items
  • I need to remember what I have already seen
  • I need to find the complement quickly

That points to a Hash Set or Hash Map.

Not because you memorized a famous problem name.

But because the prompt demands fast access to past values.

That is the habit worth training: notice the operation first, then pick the structure.

Common mistakes

  • Forcing a complex algorithm because it was the last thing you studied.
  • Naming the technique without explaining the mechanism.
  • Skipping the baseline and losing the chance to show the real bottleneck.
  • Acting like saying “sliding window” already solves the interview.

How a senior thinks

People with more experience do not throw out an algorithm name and expect the conversation to end.

They justify which constraint forced that choice.

The reasoning usually sounds like this:

I need to check quickly whether I have seen this value before, so a double loop becomes too expensive. To get O(1) lookup, I trade memory for speed with a Hash Map.

That is stronger because it shows:

  • the problem
  • the bottleneck
  • the trade-off
  • the reason

What the interviewer wants to see

In algorithm interviews, this signals depth.

The interviewer wants to see whether you can:

  • notice the structure underneath the wording
  • choose a data structure to attack the main bottleneck
  • justify the cost of that choice

Recognizing a pattern is not about remembering a famous name. It is about noticing which structure removes the real friction.

Once the justification is clear, the pattern stops looking like a trick and starts looking like engineering.

Quick summary

What to keep in your head

Practice checklist

Use this when you answer

You finished this article

Next article Strings: Manipulation and Common Interview Patterns Previous article Dynamic Programming: How to Identify the Problem Before Attacking It

Keep exploring

Related articles