https://leetcode.com/problems/sort-array-by-parity/
class Solution:
def sortArrayByParity(self, A):
"""
:type A: List[int]
:rtype: List[int]
"""
B=A.copy()
length = len(A)
j=length-1
k =0
for i in range(length):
if A[i]%2 == 0:
B[k] = A[i]
k += 1
else:
B[j] = A[i]
j -= 1
return B