My issue
plz help…
My code
#include <bits/stdc++.h>
using namespace std;
int main() {
// your code goes here
int t;
cin>>t;
while(t--){
int a,b;
cin>>a>>b;
if(a==b){cout<<0<<endl;
continue;}
if(a<b) swap(a,b);
int setbit=-5;
int y=0;
for(int i=29;i>=0;i--){
y=1<<i;
if((a&y)!=(b&y)){
setbit=i;
break;
}
}
int res=0;
for(int i=setbit-1;i>=0;i--){
int x=1<<i;
if((a&x)>0 && (b&x)==0 ||(a&x)==0 && (b&x)>0){
res+=x;
}
}
cout<<y-res<<endl;
}
return 0;
}
Problem Link: XORDIF Problem - CodeChef