# [leetcode-only] [test-case] Don't we need to consider the inputs that have same numbers in the collection?

• It seems the test cases of leetcode does not consider the inputs that have same numbers in the collection?
For example, [1,3,3].

• That Permutations 2!

Maybe in Permutations, "collection" should be replaced by "set".

• I did not notice that there is a "permutations II"

• I have also considered this issue.

• Here is my solution which takes care of duplicate numbers too..

``````class Solution {
public:
vector<vector<int>> ans;
void func(vector<int> &num,vector<int> a,int visited[], int pos)
{
if(pos==num.size())
{
ans.push_back(a);
return;
}
for(int i=0;i<num.size();i++)
{
if(visited[i]==false)
{
if(a.size()<=pos)
a.push_back(num[i]);
else
a[pos]=num[i];
visited[i]=true;
func(num,a,visited,pos+1);
visited[i]=false;
}

}
}
vector<vector<int> > permute(vector<int> &num) {
vector<int> a;
int visited[1000];
for(int i=0;i<num.size();i++) visited[i]=false;
func(num,a,visited,0);
return ans;

}
};``````

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.