思路:
根据Gray Code的定义 GC(n) = n ^ (n / 2)…
https://discuss.leetcode.com/topic/8557/an-accepted-three-line-solution-in-java
vector<int> grayCode(int n) {
vector<int> res;
for (int i = 0; i < 1 << n; i++)
res.push_back(i ^ i >> 1);
return res;
}