code :
#include
using namespace std;
int main () {
int x, y;
cin>>x>>y;
int xo = x^y;
int setbit = 0;
while(xo != 0){
xo /= 2;
setbit++;
}
setbit;
int newbit = 1 <<(setbit);
//cout<<newbit<<" "<<setbit<<endl;
int ans = newbit - 1;
cout<<ans;
return 0;
}
although I passed all the test cases but I am not very much satisfied with explanation of geeks for geeks please tell me the logic of the 1XXX form that is find rightmost set bit of upper and lower no. and rest all bits right to it will be 1, please explain this to me once