Deviopath › JavaScript

All Subsets

Hard · Recursion

Write a function subsets that returns every subset of the array nums. All numbers are different.

Each subset must be sorted ascending. Order the subsets by size (smallest first). Subsets of the same size are in lexicographic order (compare number by number from the left). The empty subset [] always comes first.

Next: All Permutations