LeetCode – Permutations II (Java)
Given a collection of numbers that might contain duplicates, return all possible unique permutations. For example, [1,1,2] have the following unique permutations: [1,1,2], [1,2,1], and [2,1,1]. Java Solution 1 Based on Permutation, we can add a set to track if an element is duplicate and no need to swap. public List<List<Integer>> permuteUnique(int[] nums) { List<List<Integer>> … Read more