FreeCareerPath
Build the PrimitiveMedium

Permutations

Write `permutations(nums)` returning every ordering of a list of distinct integers, in any order. permutations([1,2,3]) -> 6 orderings Unlike Subsets there is no start index: every unused element is a candidate at every position. Track used elements with a boolean array or by swapping in place. Expect n! results and be able to say so before you run it.

What to expect: A timer starts when you begin. Edit the starter code, run it against the test suite as many times as you like, then finish when you're done. The reference solution and interviewer follow-up questions unlock only after you finish.

Log in to start this session

Timed sessions and your results for "Permutations" are saved to your account — logging in takes a few seconds.

Permutations — FreeCareerPath