← All problemsSign in

3142. Check if Grid Satisfies Conditions

LeetCodeArrayMatrixOpen on judge ↗

You are given a 2D matrix grid of size m x n. You need to check if each cell grid[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 true if all the cells satisfy these conditions, otherwise, return false. Example 1: Input: grid = [[1,0,2],[1,0,2]] Output:

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start