Description
Submission
class Solution { public: vector<int> grayCode(int n) { vector<int> rets; rets.push_back(0); if(n == 0) return rets; for(int i = 0; i < n; ++i) { for(int j = rets.size() - 1; j >= 0; --j) { rets.push_back(rets[j] | (1<<i)); } } return rets; } };