All articles

DSA

LeetCode Is Harder Than It Looks

The hard part was never writing the code. It's knowing how to approach a problem you have never seen before.

Sep 18, 20267 min read
A LeetCode-style problem with a blank editor beside it
You understand the question. The editor is still empty. That gap is the real difficulty.

Most people starting out with LeetCode assume the hardest part will be writing the code. It usually isn't. The harder part is working out how to approach the problem in the first place.

You can understand arrays, hash maps, binary search, dynamic programming, graphs and every other topic on its own. But when a completely new problem appears, knowing which of those to reach for is surprisingly difficult. Anyone who has spent real time on LeetCode knows the feeling: you read the problem, you understand what it's asking, you look at the examples, and then nothing. No idea how to start.

That gap is one of the most frustrating parts of learning DSA, and it doesn't get discussed nearly enough. Concepts make sense when they're explained one at a time. Applying them to an unfamiliar problem is a separate skill entirely.

Knowing DSA and solving problems are not the same

You can know what a hash map is. You can know what a stack is. You can understand binary search and the basics of dynamic programming. But when someone hands you a new problem and says “solve this,” none of that knowledge tells you which piece of it applies. That is where the real difficulty begins.

Take a problem involving an array. The instinct is to reach for loops and brute force. But the intended solution might use a sliding window, or a hash map might make the whole thing collapse into something simple. Sometimes the difference between being stuck for thirty minutes and finishing in five is just recognising the underlying pattern, and that recognition takes practice to build.

The problem usually isn't the code

When a problem won't crack, the temptation is to go straight to the solution. Almost everyone does this. But there is a real difference between looking at a solution and understanding it. You can paste in some code, submit it, see the green “Accepted,” and move on. Meet a slightly different version of that problem tomorrow and you are back at the start.

The part that actually transfers is being able to answer these:

  • What is the problem actually asking?
  • What is the brute-force approach?
  • Why is that approach inefficient?
  • What observation leads to the optimised solution?
  • Which data structure or algorithm fits the problem?
  • What is the time complexity?
  • What changes if the constraints are different?

Once problems get approached this way, LeetCode stops being about memorising solutions and starts being about recognising patterns.

Patterns make a huge difference

Hundreds of different-looking problems reduce to a relatively small number of common techniques. That realisation changes how the whole exercise feels. You start noticing signals in the problem statement itself:

What the problem mentionsWhat it often points to
A contiguous portion of an arraySliding window
Repeatedly needing the smallest or largest itemHeap
Relationships between objectsGraphs
Repeated choices over overlapping subproblemsDynamic programming
Looking up whether something was seen beforeHash map

None of these are rules, and plenty of problems break them. But the more problems you solve, the more these connections start forming on their own. Getting there requires seeing the same ideas explained from several different angles, not just once.

Seeing several approaches to one problem

One of the more useful things in DSA practice is watching the same problem get solved more than one way. You start with brute force. Then you notice a hash map removes the inner loop. Then perhaps a particular pattern makes it faster still. Laid next to each other, that progression is far easier to follow than a single finished answer, and it is where an intuition for complexity actually comes from.

You start asking yourself:

  • Can this O(n²) solution become O(n)?
  • Is this extra data structure actually needed?
  • Can memory be traded for speed?
  • Is there a pattern being missed?

Those questions are worth much more in an interview than remembering the answer to one specific problem.

A feedback loop that works

Practice improves a lot when it follows a deliberate loop rather than bouncing between random solutions on the internet:

  1. Try the problem first

    Don't open the solution immediately. Give yourself real time to think about it.

  2. Name what you're stuck on

    Is it the data structure, the algorithm, the optimisation, or just understanding what the question wants?

  3. Read an explanation, not just the code

    The goal is the reasoning behind the approach, not a snippet that passes the test cases.

  4. Close it and implement it yourself

    This step is the one that does the work. Typing it from memory is very different from reading it.

  5. Come back to it later

    If you can solve the same problem days later without help, you have actually learned something.

The benefit isn't solving a problem instantly. It is having somewhere sensible to go when you are completely stuck, so that being stuck turns into progress instead of a dead end.

Where to go when you don't know how to start

At some point most people realise they don't want another list of LeetCode questions. They want to understand the reasoning behind the questions, so that a stuck moment leads to a thought process rather than to a block of final code.

That means practising somewhere the explanation matters as much as the answer. The DSA section of Scale Engineer is built along those lines: LeetCode-style problems organised by difficulty, pattern, data structure and algorithm, with multiple approaches to the same problem, complexity analysis and walkthroughs alongside them. The useful shift is going from “here is the solution, memorise it” to “why does this approach work, and why is it better than the obvious one?” That distinction matters a great deal when you are preparing for interviews.

However you practise, the pattern to aim for is the same: try it yourself, read the reasoning when you are stuck, then come back and implement it without looking. Over time you start recognising similar problems, which is the actual goal. Nobody wants to memorise five hundred solutions. You want to reach the point where a new problem makes you think, “I've seen something like this before.”

Common questions

Why is it so hard to start a LeetCode problem even after learning DSA?
Because learning a concept and choosing a concept are two different skills. Knowing what a hash map or a sliding window is does not tell you which one a new problem needs. That second skill only comes from solving problems and seeing the same ideas from different angles.
Should you look at the solution when you are stuck?
Yes, but only after giving the problem real thought, and only to understand the approach rather than to copy the code. Read the reasoning, close the solution, and implement it yourself. If you can solve it again days later without help, you have actually learned it.
How many LeetCode problems do you need to solve?
The count matters less than the coverage. Hundreds of different-looking problems reduce to a relatively small number of techniques, so solving fifty problems across many patterns teaches you more than two hundred problems from the same few.
What is pattern recognition in DSA?
It is the habit of reading a problem and noticing which known technique fits. A contiguous portion of an array suggests a sliding window. Repeatedly needing the smallest or largest element suggests a heap. Relationships between objects suggest a graph. Repeated choices over overlapping subproblems suggest dynamic programming.

What good DSA preparation feels like

Not memorising hundreds of answers. Not solving problems to move a counter up. Just gradually getting better at looking at a problem, breaking it down, recognising the pattern, and working out where to start.

Because once you know how to start, solving the problem is the easy part.