0
点赞
收藏
分享

微信扫一扫

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

目标践行者 2022-02-26 阅读 80
算法

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 条评论