Theory

The reasoning behind the patterns. Long-form explanations of the algorithms and data structures the Grind 75 problems are built on — why each one works, not just how to type it.

Binary Search

Binary search explained through the loop-invariant rule: pick an interval definition and stick to it. Two correct templates — [left, right] and [left, right) — with implementations in 15 languages.

Theory 6 problems

Sorting

Rarely the answer on its own — almost always the step that makes the real answer possible.

Theory 9 problems

Two Pointers

Two indices walking a sequence — converging, chasing, or bounding a sliding window — to replace a nested loop with a single pass.

Theory 14 problems

Sliding Window

A contiguous range with two forward-only edges, and a running answer for whatever is inside it.

Theory 3 problems

Hash Map & Sets

Trade memory for time: store what you have seen so lookups become O(1) instead of a second loop.

Theory 12 problems

Prefix Sum

Precompute running totals once, then answer any range in a single subtraction.

Theory 2 problems

Stack

Last-in-first-out ordering for nesting, matching, and monotonic scans.

Theory 8 problems

Linked List

Pointer surgery: reversing, merging, and restructuring nodes without an array's random access.

Theory 7 problems

Intervals

Sort by a start or end, then sweep once, merging or counting overlaps as you go.

Theory 3 problems

Bit Manipulation

XOR, masks, and shifts — constant-space answers to problems that look like they need a hash map.

Theory 6 problems

Depth-First Search

Recurse to the bottom, then unwind — the default traversal for trees and the backbone of most graph problems.

Theory 19 problems

Breadth-First Search

Expand level by level with a queue — the right tool whenever the answer is a shortest path or a distance.

Theory 15 problems

Graph

Modelling problems as nodes and edges, then applying traversal, topological order, or union-find.

Theory 5 problems

Backtracking

Build a candidate incrementally, abandon it the moment it cannot work, and undo the last choice.

Theory 5 problems

Priority Queue / Heap

Keep only what matters: the largest, the smallest, or the running median, in O(log n) per update.

Theory 4 problems

Greedy

Take the best option in front of you and never look back — when you can prove that is safe.

Theory 5 problems

Dynamic Programming

Find the recurrence, then stop recomputing it — memoise the recursion or fill a table bottom-up.

Theory 13 problems

Advanced Data Structures

Tries and composite structures — problems where the data structure itself is the answer.

Theory 8 problems

Miscellaneous

Problems that teach a technique of their own — prefix sums, matrix traversal, and careful string parsing.

Theory 5 problems

The part that isn’t technique#

Most people who stall on interview prep are not short of ability. They are short of uninterrupted hours and honest feedback. That distinction is worth stating plainly, because the alternative belief — that some people are simply wired for this and you are not — is both false and paralysing. The material is finite. The patterns number in the dozens, not the thousands. Steady, deliberate work gets you through them.

What follows isn’t motivational filler. It’s the short list of habits that separate the people who finish from the people who drift.

Close the solution before you believe it#

The most common way to waste an hour is to read a solution, feel it click, and move on. Recognition is not recall. You’ll feel fluent right up until the moment you’re facing a blank editor with someone watching.

After every problem, do this instead:

  1. Close the editorial and the solution tab.
  2. Say the idea out loud in ordinary language — what the invariant is, why the loop terminates, what each pointer actually means.
  3. Write the code again from nothing.

Step two is the one people skip, and it’s the one doing the work. If you can’t say why right moves to mid - 1 rather than mid, or why a traversal visits children before parents, you haven’t learned the problem — you’ve watched someone else solve it. Go back and step through a small input by hand until the reason is yours rather than borrowed.

That’s the whole method. It’s slower per problem and considerably faster per pattern.

Protect the hours, not the willpower#

The hard part of a binary search isn’t typing it. It’s holding an invariant in your head across several minutes of thought. One glance at a notification empties that buffer, and rebuilding it costs far more than the glance did.

So treat attention as a logistics problem rather than a test of character. A room with no phone in it beats any amount of resolve.

  • Put the phone somewhere else. Not face-down on the desk — another room. Distance outperforms discipline and costs nothing.
  • If it has to stay, silence it properly. Do Not Disturb, not just the ringer off.
  • Consider removing the worst apps entirely. Short-form feeds train you to expect a reward every few seconds. A hard problem pays out after forty minutes, or not at all. After a week of the first, the second genuinely feels unbearable. That’s a real effect, not a character flaw — and the fix is to stop feeding it.
  • Keep a separate device for leisure if you can. One machine for studying with nothing entertaining installed, one for everything else, opened when the session is over.

Play your own game#

Performance falls apart when your attention slides off the problem and onto yourself — onto how you’re doing, what it would mean to fail, whether you’re the sort of person who can do this at all. The thinking stops and the self-assessment takes over. Anyone who has frozen in an interview knows the feeling: the question is still there on the screen, and none of your attention is on it.

Preparation fails the same way, only slower. Every hour spent estimating your odds, measuring your progress against someone else’s, or rehearsing the rejection is an hour taken from the only activity that changes the outcome. Nobody is ranked against you here. The only comparison worth making is with the version of you who sat down last month and couldn’t finish this problem.

So judge a session by whether you worked with attention, not by whether you felt clever. Offers are a lagging indicator of that habit — they show up late, and they show up because of it.