Deviopath › JavaScript

All Permutations

Hard · Recursion

Write a function permutations that returns every ordering (permutation) of the array nums. All numbers are different.

Return the permutations sorted in lexicographic order: compare them number by number from the left, smaller numbers first. For an empty array return [[]].

Next: Combination Sum