C++/代码:

class Solution {
public:
    void reOrderArray(vector<int> &array) {
        vector<int> array1,array2;
        int m = 0,n = 0;
        for (int i = 0; i < array.size(); i ++) {
            if (array[i] % 2 == 1) array1.push_back(array[i]),m ++;
            if (array[i] % 2 == 0) array2.push_back(array[i]),n ++;
        }
        array1.insert(array1.end(),array2.begin(),array2.end());
        array = array1;
    }
};