i submitted this code, its complexity is O(Q) but still getting TLE in one testcase plz see to it
TLE in one testcase in Exist OR Not
Hi @wadhwasaab, pls add a && q>=0 in line no. 26 of your code. And your code will work fine then.
Also one TIP, instead of using the hashmap like the way u did, what you can do is:
For line 17 - 22, just do:
aval[x] = 1 ;
Now when we will recieve a query we will just chech wether ava[x] is 1 or not and the same will be done as follows for line no. 28. Use the if else as:
if ( val[x]==1 ) cout << “Yes\n” ;
else cout << “No\n” ;
And yeah since Yes and \n both are strings and \n has to appear immediately after Yes or No so you can write them together as i did in above code segment.
Hope this helps 
still getting tle in the same test case as before