We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e13374b commit b7430ddCopy full SHA for b7430dd
solution/0000-0099/0089.Gray Code/Solution.cpp
@@ -0,0 +1,10 @@
1
+class Solution {
2
+public:
3
+ vector<int> grayCode(int n) {
4
+ vector<int> res;
5
+ for (int i = 0; i < (1 << n); ++i) {
6
+ res.push_back((i >> 1) ^ i);
7
+ }
8
+ return res;
9
10
+};
0 commit comments