题目:
题解:
class Solution {
public:
int findComplement(int num) {
int pos;
for (int i = 30; i >= 0; i--) {
if (num & (1 << i)) {
pos = i;
break;
}
}
return (((1LL << (pos + 1)) - 1) ^ (num));
}
};