Reading preferences

All modules

Available

Coding Patterns in Python

Learn reusable DSA problem-solving techniques with illustrative Python examples.

Levels indicate concept complexity and prerequisites, not learner progress.

Beginner

  1. Recognising Coding Patterns — Choose a technique from the problem's rules rather than its name.

Intermediate

  1. Sliding Window — Reuse the work from one consecutive group when moving to the next. (shared from Data Structures and Algorithms · Intermediate)
  2. Two Pointers — Use two positions to make progress through an ordered row. (shared from Data Structures and Algorithms · Intermediate)
  3. Fast and Slow Pointers — Detect a linked-list cycle by moving at different speeds.
  4. Merging Intervals — Combine overlapping closed ranges without losing coverage.
  5. Cyclic Sort for Bounded Values — Place a permutation of 1 through n at its matching positions.
  6. In-Place Linked List Reversal — Reverse links while preserving the unvisited remainder.
  7. Tree Breadth-First Search — Visit a tree level by level using a queue.
  8. Tree Depth-First Search — Follow a branch before returning to its siblings.
  9. Building Subsets — Grow a power set by deciding whether to include each item.
  10. Modified Binary Search — Find the first matching position using a shrinking boundary.

Advanced

  1. Bitwise XOR for Paired Values — Cancel pairs to find one unpaired integer under a precise contract.
  2. Top K with a Min-Heap — Keep the k largest values seen so far without sorting the whole input.
  3. Priority Queues and Multiway Merge — Remove items by priority and combine several already sorted streams. (shared from Data Structures and Algorithms · Intermediate)
  4. Topological Sorting — Order tasks so each prerequisite appears before its dependent.
  5. Tries and Prefixes — Share character paths while distinguishing a word from a prefix.
  6. Dynamic Programming — Reuse overlapping subproblem answers to count step sequences.

Expert

  1. Combining Patterns and Proving Correctness — Combine sorting and two pointers while accounting for original positions and costs.