C++ easy solution || simple and straight forward || Explained !!
we create two vectors, initially vector perm[i] = i, here we are asked to return number of changes can be made according to given conditions such that the eleme
we create two vectors, initially vector `perm[i] = i`, here we are asked to return number of changes can be made according to given conditions such that the elements in our vector are `arr[i] = i`.\nso, we run a while loop until this condition satisfies and increment the` cnt`. whenever the vector satisfies the condition, we just return `cnt`(number of operation required)\n\n**Do upvote** if you find it helpful!!!\n ```\nint reinitializePermutation(int n) {\n        vector<int>perm(n,0),arr(n,0);\n        for(int i=0;i<n;i++) perm[i] =i;\n        int cnt =0,i;\n        while(1){\n            cnt++;\n            for(i=0;i<n;i++){\n                if(i % 2 == 0) arr[i] = perm[i / 2];\n                if(i % 2 == 1) arr[i] = perm[n / 2 + (i - 1) / 2];\n            }\n            perm = arr;\n            for(i=0;i<n;i++){\n                if(arr[i] != i) break;\n            }\n            if(i==n) return cnt;\n        }\n    }\n```
[]