位运算

https://leetcode.com/problems/gray-code/description/
这个位运算的解法厉害了....

class Solution {
public:
    vector grayCode(int n) {
        int size = 1< res;

        for(int i = 0;i>1) ^ i);    
        }
        return res;
    }
};

int n = n / 2 等价于 int n = n >> 1


你可能感兴趣的:(位运算)