← All problems
Subsets
MediumBacktracking
Given an array of distinct integers, return all possible subsets (the power set).
Examples
Input: [1,2,3]
Output: [[],[1],[2],[1,2],[3],[1,3],[2,3],[1,2,3]]
Hints
Solution
Language:
Loading editor…
Output0 lines
Run your code to see output here.
Click Run all tests to check your solution against 3 test cases.