My code is giving correct answer for the sample input but all the test cases are giving wrong answer. What is wrong with the code?
#include
#include<unordered_set>
using namespace std;
int main() {
int t,l,num,q,qnum;
unordered_sets;
cin>>t;
while(t–)
{
cin>>l;
for(int i=0;i<l;i++)
{
cin>>num;
s.insert(num);
}
cin>>q;
for(int i=0;i<q;i++)
{
cin>>qnum;
if(s.count(qnum))
cout<<“Yes”<<endl;
else
cout<<“No”<<endl;
}
}
return 0;
}
Exist OR Not problem of Hashing
I think i need to clear the hash map after each test case. isn’t it?
okay thank you… no its passing all the test cases