标签:import ack else turn tco repeat ++ calloc returns
int* sortArrayByParityII(int* A, int ASize, int* returnSize){
int* arr = (int*)calloc(ASize,sizeof(int));
int evenindex = 0;
int oddindex = 1;
for (int i=0; i<ASize; i++)
{
if (A[i] % 2)
{
arr[oddindex] = A[i];
oddindex+=2;
}
else
{
arr[evenindex] = A[i];
evenindex+=2;
}
}
*returnSize = ASize;
return arr;
}
标签:import ack else turn tco repeat ++ calloc returns
原文地址:https://www.cnblogs.com/ganxiang/p/13618263.html