Create two new arrays: one with only even and other with only odd. Combine the two arrays
class Solution:
def sortArrayByParity(self, nums: List[int]) -> List[int]:
lst_odd = [i for i in nums if i%2 == 1]
lst_even = [i for i in nums if i%2 == 0]
return lst_even + lst_odd
Create two new arrays: one with only even and other with only odd. Combine the two arrays