Given a collection of numbers that might contain duplicates, return all possible unique permutations.
For example, [1,1,2]
have the following unique permutations:
回溯法。 与46. Permutation差不多,只不过这里的元素是有重复的。 先将元素排序,然后在for循环中,往后跳过与当前重复的所有元素即可。
新闻热点
疑难解答