Two Pointer Solution | Python 3 | beats 90%
\nclass Solution:\n    def sortArrayByParityII(self, nums: List[int]) -> List[int]:\n        \n        e = 0 #even_index\n        o = 1 #odd_index\n        \n  
```\nclass Solution:\n    def sortArrayByParityII(self, nums: List[int]) -> List[int]:\n        \n        e = 0 #even_index\n        o = 1 #odd_index\n        \n        while e<len(nums) and o<len(nums):\n            if nums[e]%2==0:\n                e+=2\n            else:\n                if nums[o]%2!=0:\n                    o+=2\n                else:\n                    nums[e],nums[o] = nums[o],nums[e]\n                    e+=2\n                    o+=2\n                                \n        return nums\n\n```
['Two Pointers', 'Python', 'Python3']