Python 3 two pointers O(n)
\nclass Solution:\n    def sortArrayByParityII(self, A: List[int]) -> List[int]:\n\t\tans = [None] * len(A)\n\t\tk = 0\n\t\tt = 1\n\t\tfor i in A:\n\t\t\tif i %
```\nclass Solution:\n    def sortArrayByParityII(self, A: List[int]) -> List[int]:\n\t\tans = [None] * len(A)\n\t\tk = 0\n\t\tt = 1\n\t\tfor i in A:\n\t\t\tif i % 2 == 0:\n\t\t\t\tans[k] = i\n\t\t\t\tk += 2\n\t\t\telse:\n\t\t\t\tans[t] = i\n\t\t\t\tt += 2\n\t\treturn ans\n```
['Python', 'Python3']