1 class Solution(object): 2 def flipAndInvertImage(self, A): 3 """ 4 :type A: List[List[int]] 5 :rtype: List[List[int]] 6 """ 7 for i in range(len(A)): 8 temp = A[i][::-1] 9 for j in range(len(temp)): 10 temp[j] = 0 if temp[j] == 1 else 1 11 A[i] = temp 12 return A 13 14 if __name__ == '__main__': 15 solution = Solution() 16 print(solution.flipAndInvertImage([[1, 1, 0], [1, 0, 1], [0, 0, 0]]))