In C
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```c []\n#include <stdlib.h>\n\n/**\n * Note: The returned array must be malloced, assume caller calls free().\n */\nint* constructArray(int n, int k, int* returnSize) {\n    *returnSize = n;\n    int* result = (int*)malloc(n * sizeof(int));\n    \n    int left = 1, right = n;\n    \n    for (int i = 0; i < n; i++) {\n        if (k > 1) {\n            result[i] = (k % 2) ? left++ : right--;\n            k--;\n        } else {\n            result[i] = left++;\n        }\n    }\n    \n    return result;\n}\n```
['C']