Sort so duplicates are adjacent, then skip duplicates at the same recursion depth.
Backtrack by start index i.
At each level, iterate j from i..end:
j > i and nums[j] == nums[j-1], skip (avoids duplicate subsets).Sorting groups duplicates; skipping equal values at the same depth prevents generating the same subset more than once.
Sort so duplicates are adjacent, then skip duplicates at the same recursion depth.
Backtrack by start index i.
At each level, iterate j from i..end:
j > i and nums[j] == nums[j-1], skip (avoids duplicate subsets).Sorting groups duplicates; skipping equal values at the same depth prevents generating the same subset more than once.