The interview a few days ago asked, at the time, no response was reacted. Come back to think about it is very simple =. =
c ++ code is as follows
int* separate(int* iArray,int length)
{
int front=0;
int back=length-1;
while(front<back)
{
if((iArray[front]&1)==0)
{
if(!((iArray[back]&1)==0))
{
int temp=iArray[back];
iArray[back]=iArray[front];
iArray[front]=temp;front++;back–;
}else back–;
}else front++;
}
return iArray;
}