832. 翻转图像 【每日一题】

阅读 80

2022-02-26

832. 翻转图像

思路

          顾名思就是把一个二维数组每一行都倒序,然后黑白色颠倒(二值图像吗,就是0变1,1变0),

代码

class Solution:
    def flipAndInvertImage(self, image: List[List[int]]) -> List[List[int]]:
        ans=[]
        for i in image:
            ans.append(list(map(lambda x:1-x,i[::-1])))
        return ans

精彩评论(0)

0 0 举报