[C] For loop
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\n/*\n * 1806. Minimum Number of Operations to Reinitialize a Permutation\n *\n * You are given an even integer n\u200B\u200B\u200B\u200B\u200B\u200B. You initially have a permutation perm of size n\u200B\u200B where \n * perm[i] == i\u200B (0-indexed)\u200B\u200B\u200B\u200B.\n * \n * In one operation, you will create a new array arr, and for each i:\n * \n * If i % 2 == 0, then arr[i] = perm[i / 2].\n * If i % 2 == 1, then arr[i] = perm[n / 2 + (i - 1) / 2].\n * You will then assign arr\u200B\u200B\u200B\u200B to perm.\n * \n * Return the minimum non-zero number of operations you need to perform on perm to return the \n * permutation to its initial value.\n *\n * 2 <= n <= 1000\n * n\u200B\u200B\u200B\u200B\u200B\u200B is even.\n */\n\nint reinitializePermutation(int n) {\n\n    /*\n     * Input:\n     *  n\n     */\n\n    int *target = (int *)malloc(sizeof(int) * n);\n    int *perm = (int *)malloc(sizeof(int) * n);\n    int *arr = (int *)calloc(1, sizeof(int) * n);\n    int ans = 0;\n\n    for (int i = 0; i < n; i++) {\n        perm[i] = i;\n        target[i] = i;\n    }\n\n    for (; memcmp(target, arr, sizeof(int) * n) != 0; ans++) {\n        for (int i = 0; i < n; i++) {\n            if (i % 2 == 0) {\n                arr[i] = perm[i / 2];\n            }\n            else {\n                arr[i] = perm[n / 2 + (i - 1) / 2];\n            }\n        }\n\n        memcpy(perm, arr, sizeof(int) * n);\n    }\n\n    free(target);\n    free(perm);\n    free(arr);\n\n    /*\n     * Ouptut:\n     *  Return the minimum non-zero number of operations you need to perform on perm to return the \n     *  permutation to its initial value.\n     */\n\n    return ans;\n}\n```
['Array', 'Math', 'C', 'Simulation']