Pattern Recognition Drill
Medium Backtracking
The Problem
Return all permutations of a list of distinct integers.
What approach would you use?
Think about it before scrolling down.
At each position, choose from unused elements. Track used set. Collect when path length = n. O(n! * n).
Common Trap
Don't confuse with combinations. Permutations care about order: [1,2] ≠ [2,1].