70 % faster | Easy | Python
class Solution:\n    def reinitializePermutation(self, n: int) -> int:\n\t\n        perm = []\n        for i in range(n):\n            perm.append(i)\n        a
class Solution:\n    def reinitializePermutation(self, n: int) -> int:\n\t\n        perm = []\n        for i in range(n):\n            perm.append(i)\n        arr = perm.copy()\n        count = 0\n        n1 = n\n        while True:\n            count += 1\n            for i in range(0, n):\n\n                if i%2==0:\n                    arr[i] = perm[i//2]\n                else:\n                    arr[i] = perm[(n1//2) + ((i-1)//2)]\n\n            perm = arr.copy()\n\n            # check if equal\n            flag = 1\n            # print(lst)\n            for j in range(n):\n                if perm[j] != j :\n                    flag = 0\n                    break\n\n            if flag == 1:\n                break\n\n        return count
['Python']