Python - One Liner Solution Explained
\nclass Solution:\n    def sortArrayByParity(self, nums: List[int]) -> List[int]:\n        return [x for x in nums if x%2 == 0] + [x for x in nums if x%2 != 0]\
```\nclass Solution:\n    def sortArrayByParity(self, nums: List[int]) -> List[int]:\n        return [x for x in nums if x%2 == 0] + [x for x in nums if x%2 != 0]\n```\n\nAssume,\nE = the even elements from the array,\nO = the odd elements from the array.\n\nOur answer is simply E + O, i.e., ``` return [x for x in nums if x%2 == 0] + [x for x in nums if x%2 != 0]```\nHere \'+\' symbolizes List Concatenation (Joining two separate lists one after another to form a single list).
[]