Sunday, September 7, 2014

Leetcode: Gray Code @Python

class Solution:
    # @return a list of integers
    def grayCode(self, n):
        return [i^(i>>1) for i in range(1<<n)]

No comments :

Post a Comment