https://leetcode.com/problems/gray-code/description/
这个位运算的解法厉害了....
class Solution {
public:
vector<int> grayCode(int n) {
int size = 1<<n;//nums of the total;
vector<int> res;
for(int i = 0;i<size;i++){
res.push_back((i>>1) ^ i);
}
return res;
}
};
int n = n / 2 等价于 int n = n >> 1