Subsets (Backtracking)
Medium📝 Description
Generate all possible subsets of a set (power set) using backtracking.
Input Format
[a1, a2, ..., an] (array of unique integers)
Output Format
[[], [a1], [a2], ..., [a1,a2,...,an]]
Constraints
1 ≤ n ≤ 10
🔍 Sample Input
[1,2,3]
✅ Sample Output
[[],[1],[2],[1,2],[3],[1,3],[2,3],[1,2,3]]
Code Editor
Please login to run and submit code.
Results
Suggested Solution
Shortcuts: Ctrl+Enter to submit, Ctrl+Shift+R to run