[C++] Simple Brute Force Implementation
\nclass Solution {\npublic:\n    int reinitializePermutation(int n) \n    {\n        int ans = 0;vector<int> perm(n), arr(n);\n\n        for (int i = 0; i < n; 
```\nclass Solution {\npublic:\n    int reinitializePermutation(int n) \n    {\n        int ans = 0;vector<int> perm(n), arr(n);\n\n        for (int i = 0; i < n; ++i) perm[i] = i;\n\n        do\n        {\n            ++ans;\n            for (int i = 0; i < n; ++i) \n            {\n                if (i & 1) arr[i] = perm[n / 2 + (i - 1) / 2];\n                else arr[i] = perm[i / 2];\n            }\n            perm = arr;\n        } while (!isIdentity(arr, n));\n\n        return ans;\n    }\n\n    bool isIdentity(vector<int>& arr, int n) \n    {\n        for (int i = 0; i < n; ++i) if (arr[i] != i) return false;\n        return true;\n    }\n};\n\n```
['C']