Backtracking Permutation Estimated reading: 1 minute 28 views class Solution { public List> permute(int[] nums) { List> result = new ArrayList<>(); backtrack(result, new ArrayList<>(), nums); return result; } private void backtrack(List> result, List tempList, int[] nums) { if (tempList.size() == nums.length) { result.add(new ArrayList<>(tempList)); } else { for (int i = 0; i < nums.length; i++) { if (tempList.contains(nums[i])) continue; tempList.add(nums[i]); backtrack(result, tempList, nums); tempList.remove(tempList.size() - 1); } } } }