国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

Permutations II

2019-11-14 12:04:51
字體:
來源:轉載
供稿:網友

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].

void visit(vector<int> &num, int n, int pos){	if (n == pos)	{		for (int i = 0; i < num.size(); i++)		{			cout << num[i] << " ";		}		cout << endl;		return;	}	for (int i = pos; i < n; i++)	{		if (num[i] == num[pos] && i != pos)		{			continue;		}		swap(num[i], num[pos]);		visit(num, n, pos+1);		swap(num[i], num[pos]);	}}void fun(vector<int> &num){	int n = num.size();	sort(num.begin(), num.end());	visit(num, n, 0);}


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 商城县| 赤壁市| 车险| 鱼台县| 临猗县| 汉阴县| 大连市| 郁南县| 柳林县| 林口县| 社旗县| 阿拉善左旗| 青铜峡市| 铁岭市| 镇康县| 凤阳县| 杨浦区| 昌都县| 宁都县| 庆云县| 林周县| 仁怀市| 甘谷县| 铁岭县| 象山县| 南平市| 泰兴市| 乐东| 安仁县| 临安市| 云林县| 江川县| 伊川县| 嘉义市| 诏安县| 邢台市| 双鸭山市| 泊头市| 双鸭山市| 庆云县| 旅游|