class Solution {
public:
vector<int> grayCode(int n) {
// Start typing your C/C++ solution below
// DO NOT write int main() function
int size = 1<<n;
vector<int> res;
for (int i=0; i<size; i++) {
res.push_back(i^(i>>1));
}
return res;
}
};
public:
vector<int> grayCode(int n) {
// Start typing your C/C++ solution below
// DO NOT write int main() function
int size = 1<<n;
vector<int> res;
for (int i=0; i<size; i++) {
res.push_back(i^(i>>1));
}
return res;
}
};