mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-11-23 22:28:48 +00:00
13 lines
258 B
C++
13 lines
258 B
C++
class Solution {
|
|
private:
|
|
static bool cmp(int a, int b) {
|
|
return a % 2 == b % 2 ? a < b : a % 2 == 1;
|
|
}
|
|
|
|
public:
|
|
vector<int> reOrderArray(vector<int>& nums) {
|
|
sort(nums.begin(), nums.end(), cmp);
|
|
return nums;
|
|
}
|
|
};
|