Java beats 100% of solutions
\nclass Solution {\n    public int reinitializePermutation(int n) {\n        int[] perm = new int[n];\n        int[] temp = new int[n];\n        int count = 0;\
```\nclass Solution {\n    public int reinitializePermutation(int n) {\n        int[] perm = new int[n];\n        int[] temp = new int[n];\n        int count = 0;\n        for (int i=0;i<n;i++) {\n            perm[i] = i;\n            temp[i] = i;\n        }\n\n        while (true) {\n            count++;\n            int[] arr = new int[n];\n            for (int i=0;i<n;i++) {\n                if (i % 2 == 0 ) arr[i] = perm[i / 2];\n                else if (i % 2 == 1 ) arr[i] = perm[n / 2 + (i - 1) / 2];                \n            }            \n            perm = arr;\n            if (Arrays.equals(temp, perm)) return count;\n        }            \n    }\n}\n```
[]