class Solution {
public:
int exchangeBits(int num) {
int odd=num&0x55555555;
int even=num&=0xaaaaaaaa;
return (odd<<1)+(even>>1);
}
};
面试题 05.07. 配对交换
最新推荐文章于 2024-11-11 20:59:17 发布
class Solution {
public:
int exchangeBits(int num) {
int odd=num&0x55555555;
int even=num&=0xaaaaaaaa;
return (odd<<1)+(even>>1);
}
};