leetcode-160周赛-5239-循环码排列
题目描述:

参考格雷编码:
class Solution: def circularPermutation(self, n: int, start: int) -> List[int]: res = [] for i in range(2 ** n): res.append((i >> 1) ^ i) start = res.index(start) return res[start:] + res[:start]
题目描述:

参考格雷编码:
class Solution: def circularPermutation(self, n: int, start: int) -> List[int]: res = [] for i in range(2 ** n): res.append((i >> 1) ^ i) start = res.index(start) return res[start:] + res[:start]