Given an integer array nums of unique elements, return all possible subsets (the power set).
The solution set must not contain duplicate subsets. Return the solution in any order.
This is a classic backtracking problem that demonstrates the fundamental pattern: at each element, we have two choices - include it in the current subset or exclude it. By exploring both paths and backtracking, we generate all possible combinations.
The key insight is that every subset can be represented by a binary decision for each element: in (1) or out (0). For n elements, we have 2^n possible subsets.
nums = [1,2,3][[],[1],[2],[1,2],[3],[1,3],[2,3],[1,2,3]]nums = [0][[],[0]]1 <= nums.length <= 10-10 <= nums[i] <= 10All the numbers of nums are uniqueClick "Run" to execute your code against test cases
Socratic guidance - I'll ask questions, not give answers