-- coding:utf-8 --
class GrayCode: def getGray(self, n): # write code here
if n==1:
tmp=['0','1']
else:
tmp=['0'+i for i in self.getGray(n-1)]+['1'+i for i in self.getGray(n-1)[::-1]]
return tmp
tmp=['0','1']
for i in range(1,n):
left=['0'+_ for _ in tmp]
right=['1'+_ for _ in tmp[::-1]]
tmp=left+right
return tmp