simple and easy understanding c++ code
\ncpp []\nclass Solution {\npublic:\n    vector<int> sortArrayByParityII(vector<int>& nums) {\n        int n=nums.size();\n        vector<int>arr(n);\n        i
\n```cpp []\nclass Solution {\npublic:\n    vector<int> sortArrayByParityII(vector<int>& nums) {\n        int n=nums.size();\n        vector<int>arr(n);\n        int a=0,b=1;\n        for(int i=0;i<n;i++){\n            if(nums[i]%2==0){\n                arr[a]=nums[i];\n                a+=2;\n            }\n            else{\n                arr[b]=nums[i];\n                b+=2;\n            }\n        }\n        return arr;\n        \n    }\n};\n```
['C++']