Java solution
IntuitionCreate array and iterate over that array while doing giving operationApproachComplexity
Time complexity:

Space complexity:
Code
# Intuition
Create array and iterate over that array while doing giving operation 

# Approach
<!-- Describe your approach to solving the problem. -->

# Complexity
- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```java []
class Solution {
    public int reinitializePermutation(int n) {
        
        int [] perm = new int[n];
        for(int i=0;i<n;i++)
        {
            perm[i]=i;
        }
        int []original = new int[n];
        original=perm;
        int count=0;
        while(true){
            int [] arr=new int[n];
            for(int i=0;i<n;i++)
            {
                if(i%2==0){
                    arr[i] = perm[i/2];
                }else{
                    arr[i] = perm[n/2 +(i-1)/2];
                }
              
            }
           
            count++;
            if(Arrays.equals(arr,original)){
                break;
            }
            perm=arr;
        }
           
         return count;
        
    }
}
```
['Java']