class Solution {
public:
int minChanges(int n, int k) {
int res=0;
while(1){
int a=n&1;
int b=k&1;
if(a==1 && b==0)res++;
else if(a==0 && b==1) return -1;
n=n/2;
k=k/2;
if(n==0 && k>0)return -1;
if(n==0 && k==0) break;
}
return res;
}
};
位与操作 &