3142. Check if Grid Satisfies Conditions
You are given a 2D matrix
gridof sizem x n. You need to check if each cellgrid[i][j]is:
- Equal to the cell below it, i.e.
grid[i][j] == grid[i + 1][j](if it exists).- Different from the cell to its right, i.e.
grid[i][j] != grid[i][j + 1](if it exists).Return
trueif all the cells satisfy these conditions, otherwise, returnfalse.
1 | class Solution { |