Skip to main content

Subsets

MediumPremium

Given an array of distinct integers nums, return all possible subsets.

The solution set must not contain duplicate subsets. You may return the subsets in any order. The empty set ([]) is always a valid subset and should be included in the output.

Examples

Input: [2,4,3] Output: [[], [2], [4], [3], [2, 4], [2, 3], [4, 3], [2, 4, 3]] Input: [8] Output: [[], [8]]