Flip a binary matrix horizontally and then invert every bit.
You are given an binary matrix image where each element is either 0 or 1.
Perform two operations in order:
0 to 1 and every 1 to 0.Return the transformed matrix.
image of size image[i][j] is either 0 or 1image is a square matrix0 or 1Example 1
Input
image = [[1,1,0],[1,0,1],[0,0,0]]
Output
[[1,0,0],[0,1,0],[1,1,1]]
Explanation
Reverse each row first: [[0,1,1],[1,0,1],[0,0,0]]. Then invert every bit: [[1,0,0],[0,1,0],[1,1,1]].
Premium problem context
Premium adds guided hints, editorial links, similar variants, discussion resources, and concept maps so you can understand why a problem matters, not just solve it once.