leetcode - 832 - 翻转图像

class Solution:
    def flipAndInvertImage(self, A):
        """
        :type A: List[List[int]]
        :rtype: List[List[int]]
        """
        m, n =len(A),len(A[0])
        for i in range(m):
            for j in range(n):
                if A[i][j]==1:
                    A[i][j] -=1
                else:
                    A[i][j]+=1
            A[i].reverse()
        return A

            

猜你喜欢

转载自blog.csdn.net/hustwayne/article/details/83544753
今日推荐