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].
思路:这道题可以用递归的方式求解,先获得所有的数字(唯一的),然后统计这些数字的频次,递归中判断频次是否大于0,是则为位置Pos的值,不是
则获得下一个数字。
class Solution {
private:
vector<int> f;
map<int,int> unique;
vector<vector<int> > res;
public:
void ......
阅读全文