C++ solution | easy and simple
class Solution {\npublic:\n    vector sortArrayByParity(vector& nums) {\n\t\n        vectorv;\n\t\t\n\t\t// if element is even then push\n        for(int i=0; i
class Solution {\npublic:\n    vector<int> sortArrayByParity(vector<int>& nums) {\n\t\n        vector<int>v;\n\t\t\n\t\t// if element is even then push\n        for(int i=0; i<nums.size(); i++){\n            if(nums[i]%2 == 0)\n                v.push_back(nums[i]);\n        }\n\t\t\n\t\t// pushing rest elements (that are odd)\n        for(int i=0; i<nums.size(); i++){\n            if(nums[i]%2 != 0)\n                v.push_back(nums[i]);\n        }\n        return v;\n    }\n};
['C', 'C++']