一、题目
二、代码
class Solution
{
List<List<Integer>> re = new LinkedList<>();
LinkedList<Integer> path = new LinkedList<>();
void back(int[] nums)
{
if(path.size() >nums.length ) return ;
if(path.size() ==nums.length )
{
re.add(new LinkedList(path));
return ;
}
int i;
int length = nums.length;
for(i=0;i<length;i++)
{
if(path.contains(nums[i])) continue;
path.add(nums[i]);
back(nums);
path.removeLast();
}
}
public List<List<Integer>> permute(int[] nums)
{
back(nums);
return re;
}
}