Question Name: Gray Code
At the beginning, I have no idea other than brute force. But thanks to Wikipedia, the perfect solution is found.
Solution to Gray Code by LeetCode
# @return a list of integers
def grayCode(self, n):
result = 
for item in xrange(1<<n):
result.append(item ^ (item>>1))