Position: new Grad Intern
Place: India
Time: 60 minutes
There were Two questions
keys[i]&X==0 is satisfied else it will be "No".Example input
3
1 2 3
5
1
2
3
4
5Example output
Yes
Yes
No
Yes
YesExplanation
1&2=0
2&1=0
there is no element in keys whose and with 3 equals 0
4&1=0
5&2=0Constraints
N<=1e5, Q<=1e5, keys[i]<=1e5, X<=1e5
This question is similar to Distinct Subsequences II
Example input
3
110Example output
5Exaplanation
Subsequences having distinct decimal representations are 1,0,11,10,110 which corresponds to 1,0,3,2,6 in decimal.Constraints
N<=1e5
I solved first one but couldn't solve 2nd one.