Leetcode 905. Sort Array By Parity

class Solution(object):
    def sortArrayByParity(self, A):
        return [x for x in A if x % 2 == 0] + [x for x in A if x % 2 == 1]

 

posted @ 2019-04-09 06:26  周洋  阅读(120)  评论(0编辑  收藏  举报