InterviewKata
From zero to pro · works offline

Learn 24 patterns that solve most coding interview problems.

Interviewers don't hand out thousands of unrelated puzzles. They ask variations of about twenty ideas. Learn what each idea is for, how it moves, the clues that give it away, and a hook that makes it stick. Then every new problem turns into a question you already know how to answer: "which of my 24 tools fits?"

New to this? Start here → Beginner path Jump to Pattern 01 Try the pattern finder One-page cheat sheet Google interview list Meta interview list Nvidia interview list Amazon interview list Microsoft interview list Apple interview list Cisco interview list Netflix interview list
Preparing for Google, Meta, Amazon, Microsoft, Apple, Nvidia, Cisco or Netflix?The Google list (785 problems), the Meta list (377), the Amazon list (725), the Microsoft list (411), the Apple list (69), the Nvidia list (19), the Cisco list (88, all-time) and the Netflix list (29, all-time) group each company's LeetCode list by pattern, with a 6-month plan. Every Medium and Hard Python problem is solved on its pattern page (look for the Google, Meta, Amazon, Microsoft, Apple, Nvidia, Cisco and Netflix badges) with a step-through player.

How to use this course

1 · Read & watch

Every pattern page has the same 10 sections. Press Play on each visualizer, or step with ← →, and watch the pointers, windows and stacks move.

2 · Type it yourself

Every page has a Python template. Retype it from memory until you can write it without looking. Then solve the practice problems on LeetCode, which runs the full test suite for you.

3 · Spot, then solve

Before coding any problem, name the pattern and say why. Use the pattern finder and the "how to spot it" section on each page.

Beginner path: from zero, in order

New to coding interviews? Follow these steps top to bottom. Each step is one pattern page: read sections 1–6, run the visualizers, then solve its Start here problems before the rest. Hover or tap a dotted word on any page to see what it means.

  1. 0
    Foundations

    Big-O, the core data structures, recursion, the Python toolkit and how to read a LeetCode problem. Skip what you already know.

  2. 1
    Array & String Basics

    Read and write arrays and strings carefully: one pass, a lookup table, clean output.

    First problems: 13. Roman to Integer, 58. Length of Last Word, 14. Longest Common Prefix

  3. 2
    Hash Map & Set

    Remember what you've seen in a dict or set: the fix for most slow nested loops.

    First problems: 1. Two Sum, 242. Valid Anagram, 217. Contains Duplicate

  4. 3
    Stack

    Last in, first out: brackets, undo, evaluating expressions.

    First problems: 20. Valid Parentheses, 682. Baseball Game, 155. Min Stack

  5. 4
    Two Pointers

    Two indices instead of two nested loops.

    First problems: 344. Reverse String, 125. Valid Palindrome, 167. Two Sum II – Input Array Is Sorted

  6. 5
    Sliding Window

    A moving range over an array or string.

    First problems: 121. Best Time to Buy and Sell Stock, 643. Maximum Average Subarray I, 3. Longest Substring Without Repeating Characters

  7. 6
    Prefix Sum

    Running totals, so any range sum is one subtraction.

    First problems: 303. Range Sum Query – Immutable, 560. Subarray Sum Equals K, 238. Product of Array Except Self

  8. 7
    Modified Binary Search

    Halve the search space every step.

    First problems: 704. Binary Search, 35. Search Insert Position, 278. First Bad Version

  9. 8
    Fast & Slow Pointers

    Two speeds on a linked list: middles and cycles.

    First problems: 876. Middle of the Linked List, 141. Linked List Cycle, 202. Happy Number

  10. 9
    LinkedList In-place Reversal

    Rewire next pointers without losing the list.

    First problems: 206. Reverse Linked List (iterative + recursive), 21. Merge Two Sorted Lists, 92. Reverse Linked List II

  11. 10
    Top 'K' Elements

    Heaps: the k biggest, smallest or most frequent.

    First problems: 1046. Last Stone Weight, 703. Kth Largest Element in a Stream, 215. Kth Largest Element in an Array

  12. 11
    Overlapping Intervals

    Sort by start, then merge or compare neighbours.

    First problems: 252. Meeting Rooms, 56. Merge Intervals, 57. Insert Interval

  13. 12
    Monotonic Stack

    A stack kept in order: next greater or smaller element.

    First problems: 496. Next Greater Element I, 739. Daily Temperatures, 503. Next Greater Element II

  14. 13
    Recursion refresher

    Trees, graphs, backtracking and DP are all recursive. Step through the call stack once more before starting them.

  15. 14
    Binary Tree Traversal

    Visit every node of a tree; most answers are one recursive function.

    First problems: 104. Maximum Depth of Binary Tree, 226. Invert Binary Tree, 94. Binary Tree Inorder Traversal

  16. 15
    Depth-First Search (DFS) on Graphs

    Go deep first: paths, islands, components, cycles.

    First problems: 1971. Find if Path Exists in Graph, 547. Number of Provinces, 133. Clone Graph

  17. 16
    Breadth-First Search (BFS)

    Level by level with a queue: shortest paths when every step costs 1.

    First problems: 637. Average of Levels in Binary Tree, 111. Minimum Depth of Binary Tree, 994. Rotting Oranges

  18. 17
    Matrix Traversal

    A grid is a graph: neighbours are up, down, left and right.

    First problems: 733. Flood Fill, 200. Number of Islands, 695. Max Area of Island

  19. 18
    Backtracking

    Choose, explore, un-choose: subsets, permutations, combinations.

    First problems: 78. Subsets, 46. Permutations, 39. Combination Sum

  20. 19
    Dynamic Programming Patterns

    Backtracking with a memory: reuse answers to smaller problems.

    First problems: 509. Fibonacci Number, 70. Climbing Stairs, 198. House Robber (1-D linear)

  21. 20
    Greedy

    Take the locally best choice when you can prove it's safe.

    First problems: 122. Best Time to Buy and Sell Stock II, 55. Jump Game, 1833. Maximum Ice Cream Bars

  22. 21
    Trie & Design

    Build your own structures: prefix trees and O(1) designs.

    First problems: 208. Implement Trie (Prefix Tree), 1472. Design Browser History, 146. LRU Cache

  23. 22
    Shortest Path & MST

    Weighted graphs: cheapest routes and connections.

    First problems: 743. Network Delay Time, 1584. Min Cost to Connect All Points, 1631. Path With Minimum Effort

  24. 23
    Math & Bit Manipulation

    Number and bit tricks.

    First problems: 1492. The kth Factor of n, 7. Reverse Integer, 50. Pow(x, n)

  25. 24
    Union-Find (Disjoint Set Union)

    Groups that only ever merge.

    First problems: 684. Redundant Connection, 990. Satisfiability of Equality Equations, 1319. Number of Operations to Make Network Connected

  26. 25
    Segment Tree & Fenwick Tree

    Range queries with updates.

    First problems: 307. Range Sum Query - Mutable, 3479. Fruits Into Baskets III, 315. Count of Smaller Numbers After Self

The 24 patterns at a glance

The italic line on each card is its memory hook. Learn the hooks first and the details will attach to them.

How the patterns relate (memory palace)

Group the 24 into six "rooms". When you read a problem, first pick the room from the data structure, then the pattern inside it.

Room A · Arrays & stringscontiguous ranges, ordered scans Room B · Linked listspointer surgery, no random access Room C · Order & rankingnext greater, k-th, sorted space, range queries Room D · Trees, graphs & gridsnodes + edges; visit everything once Room E · Try all choices (smartly)"all ways", "min/max ways", "count ways" Room F · Core toolkithash maps, stacks, tries, bits & math, careful scans: the building blocks every other room uses

Pattern finder: identify the pattern from a problem

Answer a few questions about the problem in front of you. Each answer narrows things down until one or two patterns are left, the same way an expert thinks it through.

Keyword → pattern lookup

If the problem says…Think

The 6-step method for any problem (UMPIRE)

  1. Understand. Restate the problem in your own words. Work 2 small examples by hand, plus one edge case (empty input, a single element, all equal values, negatives).
  2. Match. Name the input shape (array, string, list, tree, graph, grid). Find the trigger words. Pick a pattern and say why out loud.
  3. Plan. Write the brute force first in one sentence and give its Big-O. Then explain how the pattern removes the wasted work.
  4. Implement. Start from the pattern's template. Name variables after their meaning (left, window_sum, seen).
  5. Review. Trace your code by hand on your small example. Check the loop bounds and the off-by-ones.
  6. Evaluate. State the time and space complexity, then suggest one improvement or trade-off.
Big-O in one minuten ≤ 10 → backtracking O(n!) or O(2ⁿ) is fine · n ≤ 20 → O(2ⁿ) · n ≤ 500 → O(n³) · n ≤ 5,000 → O(n²) · n ≤ 10⁶ → O(n log n) or O(n). The constraint on n often tells you the pattern.

An 8-week study plan

Week 0

Foundations

Big-O, data structures, recursion and the Python toolkit. Skip what you know.

Week 1

Array & String Basics, Hash Map & Set, Stack

The toolkit every other pattern is built from.

Week 2

Prefix Sum, Two Pointers, Sliding Window

Arrays and strings: the most common round.

Week 3

Fast & Slow, List Reversal, Monotonic Stack

Pointer surgery and the stack trick.

Week 4

Top K, Intervals, Binary Search

Ordering, heaps and halving the search space.

Week 5

Tree Traversal, DFS, BFS, Shortest Path & MST

Recursion becomes natural; then add weights.

Week 6

Matrix, Backtracking, Trie & Design

Grids, decision trees and building your own structures.

Week 7

Dynamic Programming, Greedy + mixed review using the cheat sheet

Backtracking + memory = DP; one safe choice = Greedy.

Week 8

Math & Bits, Union-Find, Segment & Fenwick Tree

The specialist tools that turn hard problems into short ones.

Preparing for a specific interview over a longer period? The 6-month Google plan, Meta plan, Amazon plan, Microsoft plan, Apple plan, Nvidia plan, Cisco plan and Netflix plan spread the same patterns over 26 weeks with each company's real interview problems.

Daily routine (60–90 min)10 min: redo yesterday's problem from scratch · 20 min: read one section and run its visualizer · 40 min: solve 1–2 practice problems, timing yourself (25 min for a medium) · 5 min: write the trigger words you noticed into a notebook.
Spaced repetition beats crammingRe-solve each problem 1 day, 3 days, 7 days and 21 days after first solving it. If you can't name the pattern within 2 minutes, re-read that pattern's "How to spot it" section.