//双指针:类同快排思路:i从前往后遍历找到偶数,j从后往前遍历找到奇数,二者交换
#include <algorithm>
class Solution {
public:
void reOrderArray(vector<int> &array) {
int l = 0 , r = array.size()-1;
while(l<r){
while(l<r && array[l]%2 == 1)
l++;
while(l<r && array[r]%2 == 0)
r--;
if(l<r)
swap(array[l],array[r]);
}
}
};