C solution
\nint *sortArrayByParityII(int const *A, int ASize, int *returnSize) {\n    int odd = 1, even = 0;\n    int *ret = (int *) malloc(sizeof(int) * (*returnSize = A
```\nint *sortArrayByParityII(int const *A, int ASize, int *returnSize) {\n    int odd = 1, even = 0;\n    int *ret = (int *) malloc(sizeof(int) * (*returnSize = ASize));\n    for (int i = 0; i < *returnSize; ++i) {\n        if (A[i] % 2 == 0) {\n            ret[even] = A[i];\n            even += 2;\n        } else {\n            ret[odd] = A[i];\n            odd += 2;\n        }\n    }\n    return ret;\n}\n```
[]