Blind 75 Backtracking Questions
2 problems · Free practice
Backtracking explores candidate solutions while keeping the current path small. Each recursive step makes a choice, explores its consequences, and undoes that choice before trying another. The state belongs to the current path: a cell used by one word-search attempt must become available to the next attempt.
Practice backtracking
Combination Sum
MediumGiven distinct positive integers and a nonnegative target, return all value combinations summing to the target. Each value can be reused; combinations differing only in order are the same.
Word Search
MediumDetermine whether a nonempty word can be traced in a rectangular character board by horizontal or vertical moves, without using a cell twice in that path.
What to focus on
- Define the success condition and the conditions that end a branch early.
- Use an ordered candidate index to avoid producing the same combination in different orders.
- Copy completed answers before changing the working path again.