class Solution: def flipAndInvertImage(self, A: List[List[int]]) -> List[List[int]]: for a in A: first = 0 last = len(a)-1 while first
48ms,13.1M
优化一:
class Solution: def flipAndInvertImage(self, A: List[List[int]]) -> List[List[int]]: return [[1-row[i] for i in range(len(row)-1,-1,-1)] for row in A]
48ms,13.2M