[ Web Proxy ]
URL:
Viewing: https://raw.githubusercontent.com/tehsints/LeetCode-Solutions/master/Python/gray-code.py [Back]  [Original]

# Time:  O(2^n)
# Space: O(1)

class Solution(object):
    def grayCode(self, n):
        """
        :type n: int
        :rtype: List[int]
        """
        result = [0]
        for i in xrange(n):
            for n in reversed(result):
                result.append(1 > 1 ^ i for i in xrange(1 

Web Proxy Viewer  |  New URL  |  Original Page