[C++] Two pointers solution
\tclass Solution {\n\tpublic:\n\t\tvector sortArrayByParityII(vector& nums) {\n\t\t\tint n = nums.size();\n\t\t\tint i = 0, j = 1;\n\t\t\twhile(i < n && j < n){
\tclass Solution {\n\tpublic:\n\t\tvector<int> sortArrayByParityII(vector<int>& nums) {\n\t\t\tint n = nums.size();\n\t\t\tint i = 0, j = 1;\n\t\t\twhile(i < n && j < n){\n\t\t\t\tif(nums[i] % 2 == 0){\n\t\t\t\t\ti += 2;\n\t\t\t\t}\n\t\t\t\telse if(nums[j] % 2 == 1){\n\t\t\t\t\tj += 2;\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\tswap(nums[i], nums[j]);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn nums;\n\t\t}\n\t};
['Two Pointers', 'C', 'C++']