[Python3] simulation
\n\nclass Solution:\n    def reinitializePermutation(self, n: int) -> int:\n        ans = 0\n        perm = list(range(n))\n        while True: \n            an
\n```\nclass Solution:\n    def reinitializePermutation(self, n: int) -> int:\n        ans = 0\n        perm = list(range(n))\n        while True: \n            ans += 1\n            perm = [perm[n//2+(i-1)//2] if i&1 else perm[i//2] for i in range(n)]\n            if all(perm[i] == i for i in range(n)): return ans\n```
['Python3']