///// in java ( i don't know why it got accepted in return  count+1)
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nimport java.util.Arrays;\n\nclass Solution {\n    public int reinitializePermutation(int n) {\n        int count = 0;\n\n        int[] perm = new int[n];\n        int[] arr = new int[n];\n        int[] temp = new int[n];\n\n        for (int i = 0; i < n; i++) {\n            perm[i] = i;\n            arr[i] = i;\n        }\n\n        while (true) {\n            for (int i = 0; i < n; i++) {\n                if (i % 2 == 0) {\n                    temp[i] = arr[i / 2];\n                } else {\n                    temp[i] = arr[n / 2 + (i - 1) / 2];\n                }\n            }\n\n            // Check if arr is back to the initial permutation\n            if (Arrays.equals(perm, temp)) {\n                break;\n            } else {\n                // Swap arr and temp arrays\n                int[] tempSwap = arr;\n                arr = temp;\n                temp = tempSwap;\n                count++;\n            }\n        }\n\n        return count+1;\n    }\n}\n\n```
['Java']