Find a lesson, question or project

Start typing to search published content and planned structures.

↑ ↓ moveEnter openEsc close
01 / WHAT IT SOLVES

Generating combinations, permutations and valid configurations.

02 / HOW TO RECOGNIZE IT
  • all combinations
  • choose or skip
  • return every valid arrangement
03 / PROTECT THIS INVARIANT

The current path represents exactly the decisions made before the current depth.

04 / EXPECTED COST

Often exponential because the output is exponential. Typical auxiliary space: O(depth), excluding output.

JAVA STARTING POINT

A template to adapt, not memorize.

Java
path.add(value);
search(nextIndex, path, answer);
path.remove(path.size() - 1);
search(nextIndex, path, answer);

Common mistakes

  • Forgetting to undo a choice
  • Adding the mutable path without copying it
  • Claiming output space as constant

PUBLISHED / 29

Learn in this order.

Available articles always appear before the publishing plan.

PLANNED PRACTICE

What comes after the published lessons.

  1. Combination sumPlanned, not yet published
  2. PermutationsPlanned, not yet published