比较简单的模拟题。
#905 class Solution(object): def sortArrayByParity(self, A): """ :type A: List[int] :rtype: List[int] """ ret = [] for i in A: if i % 2 == 0: ret.insert(0, i) else: ret.append(i) return ret
#832 class Solution(object): def flipAndInvertImage(self, A): """ :type A: List[List[int]] :rtype: List[List[int]] """ ret =[] for i in A: i.reverse() ret.append([(j+1)%2 for j in i]) return ret