Flip and Invert Matrix
You are given a two-dimensional integer matrix matrix
containing 1
s and 0
s. For each row in matrix
, reverse the row. Then, flip each value in the matrix such that any 1
becomes 0
and any 0
becomes 1
.
Constraints
n, m ≤ 250
wheren
andm
are the number of rows and columns inmatrix
https://binarysearch.com/problems/Flip-and-Invert-Matrix
Examples
Example 1
Input
- matrix =
[[1,1,0],
[0,0,1],
[0,0,0]]
Output
- answer =
[[1, 0, 0], [0, 1, 1], [1, 1, 1]]
Leave a comment