[C++] Two Pointers || Inplace || O(n) time
\nclass Solution {\npublic:\n    vector<int> sortArrayByParityII(vector<int>& nums) {\n        for(int i=0,j=0;i<nums.size();){\n\t\t\t// If we get an odd numbe
```\nclass Solution {\npublic:\n    vector<int> sortArrayByParityII(vector<int>& nums) {\n        for(int i=0,j=0;i<nums.size();){\n\t\t\t// If we get an odd number or  an even number which is already processed then leave that number  \n            if(nums[i]&1 || (i<j && !(i&1))){ \n                i++;\n            }\n            else{\n                swap(nums[i],nums[j]); // Placing even numbers at their right place. By doing this, the odd numbers will come in their place automatically\n                j+=2;\n            }\n        }\n        return nums;\n    }\n};\n```
['Two Pointers', 'C']