classSolution:defflipAndInvertImage(self, image: List[List[int]])-> List[List[int]]:
re =[]for i in image:
re1 =[]
c = i.copy()
n =len(i)
k = n -1for j inrange(n):
i[j]=1- c[k]
re1.append(i[j])
k -=1
re.append(re1)return re
python特有方法
classSolution:defflipAndInvertImage(self, A: List[List[int]])-> List[List[int]]:for row in A:for k,_ inenumerate(row):
row[k]=1- row[k]
i, j =0,len(row)-1while i < j:
row[i], row[j]= row[j], row[i]
i, j = i +1, j -1return A
832. 翻转图像class Solution: def flipAndInvertImage(self, image: List[List[int]]) -> List[List[int]]: re = [] for i in image: re1 = [] c = i.copy() n = len(i) k = n - 1 for j