c++ EASY SOLUTION
class Solution\n{\npublic:\n\n    vector sortArrayByParityII(vector &nums)\n    {\n        vector v;\n        vector v1;\n        vector v2;\n\n        for (int
class Solution\n{\npublic:\n\n    vector<int> sortArrayByParityII(vector<int> &nums)\n    {\n        vector<int> v;\n        vector<int> v1;\n        vector<int> v2;\n\n        for (int i = 0; i < nums.size(); i++)\n        {\n            if (nums[i] & 1)\n            {\n                v2.push_back(nums[i]);\n            }\n            else\n            {\n                v1.push_back(nums[i]);\n            }\n        }\n\n        for (int i = 0; i < nums.size() / 2; i++)\n        {\n            v.push_back(v1[i]);\n            v.push_back(v2[i]);\n        }\n        return v;\n    }\n};
[]