Pattern 17: Backtracking
Comes up in: DSA
This concept is being written. It gets the full five steps — explanation, predict, interview angle, practice with tests, and review cards. Here is exactly what it will cover, so you can study it elsewhere in the meantime.
What it covers
- choose → explore → un-choose template
- pruning
- subsets vs permutations vs combinations
- complexity (exponential)
- duplicates handling
Words you will know
What you will practise
- subsets (M)
- permutations (M)
- combination-sum (M)
- word-search (M)
- n-queens (H)
Interview questions this answers
- How do you recognise a DP problem?
- Generate all subsets of a set. What is the complexity?
- What is the difference between backtracking and DP?