LeetCode 46. Permutations

Given a collection of distinct numbers, return all possible permutations.

For example,
[1,2,3] have the following permutations:
[
[1,2,3],
[1,3,2],
[2,1,3],
[2,3,1],
[3,1,2],
[3,2,1]
]

题目大意:给一个不同数字的集合,返回它的所有可能的排列~

分析:对nums进行排序,然后将所有全排列结果放入result数组中返回~