Skip to content

Commit 7da82ba

Browse files
committed
Add 905-SortArrayByParity.cpp
1 parent 32378de commit 7da82ba

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
bool cmp(int x, int y){
2+
return (x % 2) < (y % 2);
3+
}
4+
5+
class Solution {
6+
public:
7+
vector<int> sortArrayByParity(vector<int>& nums) {
8+
sort(nums.begin(), nums.end(), cmp);
9+
return nums;
10+
}
11+
};

0 commit comments

Comments
 (0)