LeetCode Patterns

Algorithms by pattern, with worked solutions.

10 articles

  1. 01

    LeetCode (1): Patterns — Hash Tables

    Master hash table patterns through four classic LeetCode problems — Two Sum, Group Anagrams, Longest Substring Without …

    32 min
  2. 02

    LeetCode (2): Patterns — Two Pointers

    A deep tour of the two-pointer family: collision, fast/slow, sliding window, and partition pointers. Five problems (Two …

    30 min
  3. 03

    LeetCode (3): Patterns — Linked List Operations

    A complete linked list toolkit: reversal (iterative and recursive), merging sorted lists, Floyd's cycle detection, …

    36 min
  4. 04

    LeetCode (4): Patterns — Sliding Window Technique

    Master fixed-size and variable-size sliding window patterns. Solve Maximum Sum Subarray, Longest Substring Without …

    32 min
  5. 05

    LeetCode (5): Patterns — Binary Search

    A working coder's guide to binary search: three templates, rotated arrays, peak finding, and binary search on the answer …

    36 min
  6. 06

    LeetCode (6): Patterns — Binary Tree Traversal and Construction

    A unified mental model for binary trees: how the four traversal orders are really one DFS recipe, why recursion and an …

    32 min
  7. 07

    LeetCode (7): Patterns — Dynamic Programming Basics

    Master dynamic programming through a single recipe: define the state, write the transition, anchor the base case. Worked …

    32 min
  8. 08

    LeetCode (8): Patterns — Backtracking Algorithms

    Master the universal backtracking template through six classic problems: Permutations, Combinations, Subsets, Word …

    36 min
  9. 09

    LeetCode (9): Patterns — Greedy Algorithms

    When does picking the locally best option give the global optimum? A working tour of greedy algorithms with proofs …

    30 min
  10. 10

    LeetCode (10): Patterns — Stack and Queue

    Master stack and queue applications: valid parentheses, monotonic stack for next greater element, BFS with queues, …

    32 min