C++ just follow the instructions
\nclass Solution {\npublic:\n    int reinitializePermutation(int n) {\n        vector<int> orig(n, 0);\n        iota(orig.begin(), orig.end(), 0);\n        vect
```\nclass Solution {\npublic:\n    int reinitializePermutation(int n) {\n        vector<int> orig(n, 0);\n        iota(orig.begin(), orig.end(), 0);\n        vector<int> prev = orig;\n        vector<int> temp(n, 0);\n        int cnt = 0;\n        while (temp != orig) {\n            for (int i = 0; i < n; i++)\n                temp[i] = (i % 2 == 0) ? prev[i / 2] :\n                                         prev[n / 2 + (i - 1) / 2];\n            prev = temp;\n            cnt++;\n        }\n        return cnt;\n    }\n};\n```
['C']