Given a collection of 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], and [3,2,1]. 分析图如下,简单的说就是第一个数分别和后面的数交换. 拿[1,2,3,4]举例,当我们固定第一个数之后,相当于后三个数做全排列,是个子问题,即在以该三…