思路:
先对图像进行水平翻转,然后反转图片(对每个像素进行异或操作)
代码:
class Solution: def flipAndInvertImage(self, A: List[List[int]]) -> List[List[int]]: a = [a[::-1] for a in A] for i in range(len(a)): for j in range(len(a[i])): a[i][j] = a[i][j] ^ 1 return a
原文:https://www.cnblogs.com/tianyahai/p/10868522.html