题目链接:https://www.acwing.com/problem/content/description/30/
题目如下:
class Solution {
public:
void reOrderArray(vector<int> &array) {
int n=array.size();
int l=0,r=n-1;
while(l<r){
while(l<r&&array[l]%2!=0) ++l;
while(l<r&&array[r]%2==0) --r;
if(l<r) swap(array[l],array[r]);
}
}
};