Free beta: 60 days of full access, no card needed.127 seats leftSign up free

We use necessary cookies to run the site (sign-in and language). If you accept, we also load Google Analytics to see which pages are used, and Google reCAPTCHA to keep spam off the contact and bug-report forms. Privacy policy

Algorithm patterns: all 52, and which one a problem needs

Most interview problems are one of a small number of shapes wearing a new story. Each page below names the shape, the words in a problem that point at it, and the neighbour it gets confused with.

Arrays

Hashing

Two pointers

Sliding window

Prefix sums

Searching

Sorting

Intervals

Linked lists

Stacks and queues

Recursion

Backtracking

Trees

Heaps and top-k

Graphs

Greedy

Dynamic programming

Strings and dynamic programming

Strings

Bit manipulation

Math and number theory

Matrix

Advanced