C++ solution | Two pointer | In-place
\nclass Solution {\npublic:\n    vector<int> sortArrayByParityII(vector<int>& nums) {\n        int evenPointer = 0, oddPointer = 1;\n        while(evenPointer <
```\nclass Solution {\npublic:\n    vector<int> sortArrayByParityII(vector<int>& nums) {\n        int evenPointer = 0, oddPointer = 1;\n        while(evenPointer < nums.size() && oddPointer <nums.size()){\n            if(nums[evenPointer] %2 == 1 && nums[oddPointer]%2==0){\n                swap(nums[evenPointer],nums[oddPointer]);\n                evenPointer+=2;\n                oddPointer+=2;\n                continue;\n            }\n            if(nums[evenPointer]%2==0){\n                evenPointer+=2;\n            }\n            if(nums[oddPointer]%2==1){\n                oddPointer+=2;\n            }\n        }\n        return nums;\n    }\n};\n```
['Two Pointers', 'C']