class Solution:
def sortArrayByParity(self, A):
"""
:type A: List[int]
:rtype: List[int]
"""
a=[]
b=[]
for i in A:
if i % 2 ==0 :
a.append(i)
else:
b.append(i)
return a+b
leetcode - 905 - 按奇偶排序数组
最新推荐文章于 2022-04-28 10:41:51 发布
class Solution:
def sortArrayByParity(self, A):
"""
:type A: List[int]
:rtype: List[int]
"""
a=[]
b=[]
for i in A:
if i % 2 ==0 :
a.append(i)
else:
b.append(i)
return a+b