Quesiton
Given a collection of distinct numbers, return all possible permutations.
For example,
[1,2,3] have the following permutations:
Explanation
这道题是排列组合问题,所以用DFS和回溯法递归。注意长度要和原来的数组长度相等。
Given a collection of distinct numbers, return all possible permutations.
For example,
[1,2,3] have the following permutations:
这道题是排列组合问题,所以用DFS和回溯法递归。注意长度要和原来的数组长度相等。