We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 32378de commit 7da82baCopy full SHA for 7da82ba
Leet_Code/Random Problem/905-SortArrayByParity.cpp
@@ -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