Permutations
Backtracking/Permutations
Problem
Given an array nums
of distinct integers, return all the possible permutations. You can return the answer in any order.
For example:
Thought Process
We are essentially picking and placing the number in a seperate list and recursing on the new list without that number present
Solution
Key Points
In our for-loop, we separate the specific number from the rest of the numbers, append the seperated number to our new list, and recurse on the new seperated list
Time Complexity
Last updated
Was this helpful?