Lintcode16 Permutations II solution problem solution
[topic description]
Given a list of numbers with duplicate number in it. Find all unique permutations.
Give a list with duplicate numbers and find out all the different arrangements in the list.
[topic link]
Http://www.lintcode.com/en/problem/permutations-ii/
[topic Analysis]
Like the solution of Permutations, it is necessary to consider "de-duplication". Sort the array first, so that in DFS, you can first determine whether the previous number is equal to yourself, and if it is equal, the preceding number must be used before you can use it, so that there is no repetitive arrangement.
Compared with Permitations's code, only 3 lines have been added, Line 8, 23 and 24.
[answer link]
Http://www.jiuzhang.com/solutions/permutations-ii/