LeetCode题目:Gray Code

原题地址:https://leetcode.com/problems/gray-code/

class Solution {
public:
    vector<int> grayCode(int n) {
        vector<int> coll;
        if(n == 0 || n == 1) {
            coll.push_back(0);
            if(n)
                coll.push_back(1);
            return coll;
        }
        coll = (grayCode(n - 1));
        int i = coll.size() - 1;
        for(; i >= 0; --i)
            coll.push_back(pow(2.0, n - 1) + coll[i]);

        return coll;
    }
};
原文地址:https://www.cnblogs.com/runnyu/p/5239499.html