832. Flipping an Image
https://leetcode.com/problems/flipping-an-image/
js
/**
* @param {number[][]} A
* @return {number[][]}
*/
var flipAndInvertImage = function(A) {
return A.map(row => row.slice().reverse().map(x => 1 - x))
}
py
class Solution:
def flipAndInvertImage(self, A):
"""
:type A: List[List[int]]
:rtype: List[List[int]]
"""
return [[1 - x for x in reversed(row)] for row in A]