Skip to content

Commit

Permalink
Sync LeetCode submission - Sort Array By Parity (cpp)
Browse files Browse the repository at this point in the history
  • Loading branch information
sheikh-arman committed Sep 28, 2023
1 parent b321ffa commit b52d7af
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions AC-Submissions/problems/sort_array_by_parity/solution.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
class Solution {
public:
vector<int> sortArrayByParity(vector<int>& nums) {
deque<int>V;
for(int i:nums){
if(i%2)V.push_back(i);
else V.push_front(i);
}
nums.clear();
for(int i:V)nums.push_back(i);
return nums;
}
};

0 comments on commit b52d7af

Please sign in to comment.