C++STL
class Solution {
public:
void reOrderArray(vector<int> &array) {
std::stable_partition(array.begin(), array.end(), [](int x){
return (x % 2) != 0;
});
}
};
class Solution {
public:
void reOrderArray(vector<int> &array) {
std::stable_partition(array.begin(), array.end(), [](int x){
return (x % 2) != 0;
});
}
};相关推荐