进行一次快排即可
class Solution { public: vector<int> exchange(vector<int>& nums) { int le = 0; int ri = nums.size() - 1; while(le<ri){ while (le < ri&&nums[ri] % 2 == 0) ri--; while (le < ri&&nums[le] % 2 == 1) le++; if (le < ri) { int temp = nums[le]; nums[le] = nums[ri]; nums[ri] = temp; } } return nums; } };