leetcode

Solution to some Leetcode problems written in C++
git clone git://git.dimitrijedobrota.com/leetcode.git
Log | Files | Refs | README | LICENSE

0905.cpp (282B)


      1 class Solution {
      2   public:
      3     vector<int> sortArrayByParity(vector<int> &nums) {
      4         vector<int> res;
      5         for (int i : nums)
      6             if (i % 2 == 0) res.push_back(i);
      7         for (int i : nums)
      8             if (i % 2 == 1) res.push_back(i);
      9         return res;
     10     }
     11 };