My issue
Some of the test cases are not satisfied ,could you help me how to correct it.
My code
#include <iostream>
#include <vector>
#include<algorithm>
using namespace std;
int main()
{
int t,n;
cin>>t;
while(t--)
{
cin>>n;
vector <int> vec;
for(int i=0;i<n;i++)
{
int a;
cin>>a;
vec.emplace_back(a);
}
int c=0;
for(auto it:vec)
{
if(count(vec.begin(),vec.end(),it)==1)
c++;
else
{
cout<<(n-count(vec.begin(),vec.end(),it))+1<<endl;
break;
}
}
if(c>0)
cout<<c<<endl;
}
return 0;
}
Problem Link: CodeChef: Practical coding for everyone