Brute force solution
\n# Approach\niterate until you are not getting same array combination\n Describe your approach to solving the problem. \n\n\n# Code\n\nclass Solution {\npublic
\n# Approach\niterate until you are not getting same array combination\n<!-- Describe your approach to solving the problem. -->\n\n\n# Code\n```\nclass Solution {\npublic:\n    int reinitializePermutation(int n) {\n        vector<int>v,temp;\n        for(int i=0;i<n;i++){\n            v.push_back(i);\n            temp.push_back(i);\n        }\n        int k = 0;\n        while(k<1000){\n           \n           vector<int>currTemp;\n        \n           for(int i=0;i<n;i++){\n             if(i%2==0){\n                currTemp.push_back(temp[i/2]);\n             }else{\n                currTemp.push_back(temp[n/2 + (i-1)/2]);\n             }\n           }\n           k++;\n           if(currTemp==v){\n            return k;\n           }\n           temp = currTemp;\n        }\n        return 1000;\n    }\n};\n```
['C++']