```
public List<List<Integer>> permuteUnique(int[] nums) {
List<List<Integer>> result=new ArrayList<List<Integer>>();
boolean[] visited=new boolean[nums.length];
helper(result,visited,nums,new ArrayList<Integer>());
return result;
}
private void helper(List<List<Integer>> result, boolean[] visited, int[] nums, List<Integer> list){
if(list.size()==nums.length){
result.add(list);
return;
}
for(int i=0;i<nums.length;i++){
if(!visited[i]){
List<Integer> newList=new ArrayList<Integer>(list);
newList.add(nums[i]);
visited[i]=true;
helper(result,visited,nums,newList);
visited[i]=false;
}
}
}
```

After changed to https://leetcode.com/discuss/41373/standard-dfs-java-solution , the code would be accepted.