-
Notifications
You must be signed in to change notification settings - Fork 34
/
Permutations_II.cpp
34 lines (31 loc) · 767 Bytes
/
Permutations_II.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/*
Author: Weixian Zhou, ideazwx@gmail.com
Date: Jul 10, 2012
Problem: Permutations II
Difficulty:
Source: http://www.leetcode.com/onlinejudge
Notes:
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].
Solution:
The instinct way is simply borrow a set to save the permuations. This
takes O(n^2 * lgn).
Is there a better solution?
*/
#include <vector>
#include <set>
#include <climits>
#include <algorithm>
#include <iostream>
#include <sstream>
#include <cmath>
#include <cstring>
using namespace std;
class Solution {
public:
vector<vector<int> > permuteUnique(vector<int> &num) {
}
};