Python easy 2-liner
\nclass Solution:\n    def sortArrayByParityII(self, A):\n        even, odd = [a for a in A if not a % 2], [a for a in A if a % 2]\n        return [even.pop() i
```\nclass Solution:\n    def sortArrayByParityII(self, A):\n        even, odd = [a for a in A if not a % 2], [a for a in A if a % 2]\n        return [even.pop() if not i % 2 else odd.pop() for i in range(len(A))]\n```
[]