Skip to content
ReadMe Daily

Search articles, problems, patterns and every cheat sheet topic.

Problem-solving patterns

Most DSA problems are variations on a small set of techniques. Learn the technique once, then recognise it in new problems.

Arrays and strings

Techniques for getting through a list or a piece of text in a single pass.

  1. Hashing

    Remember what you have seen in a map or set, so each later check is a lookup instead of a loop.

    4 practice problems

  2. Two Pointers

    Move two indexes through a sequence, usually from both ends towards the middle, to avoid a nested loop.

    5 practice problems

  3. Sliding Window

    Keep a running result for a contiguous range and update it as the range moves, instead of recalculating from scratch.

    5 practice problems

  4. Prefix Sums

    Store running totals once, then get the sum of any range with a single subtraction.

    3 practice problems

Searching

Finding a value or a boundary in sorted data without looking at every item.

  1. Binary Search on the Answer

    Guess the answer, test the guess with a quick yes-or-no check, and halve the range of possible answers.

    3 practice problems

  2. Peak Finding

    Find the top of data that rises then falls by asking which slope the middle item is on.

    3 practice problems

Stacks and linked lists

Problems where the order things arrive in, or the links between them, do the work.

  1. Stack and Monotonic Stack

    Keep unfinished items on a stack and resolve the most recent one first, in O(n).

    3 practice problems

  2. Linked List Pointer Techniques

    Solve linked list problems in place with fast and slow pointers, link reversal and a dummy head.

    3 practice problems