Skip to content

Practice Check if Grid Satisfies Conditions

Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.

Easy#3142
LeetCode Problem

Check if Grid Satisfies Conditions

Problem Statement

Given grid, return true only if every cell equals the cell directly below it, when that neighbor exists, and differs from the cell directly to its right, when that neighbor exists. Otherwise return false.

Source: Check if Grid Satisfies Conditions on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
grid = [[1,0,2],[1,0,2]]
Output
true

# Example 2

Input
grid = [[1,1,1],[0,0,0]]
Output
false

# Example 3

Input
grid = [[1],[2],[3]]
Output
false

Constraints

1 <= n, m <= 10
0 <= grid[i][j] <= 9

Related LeetCode Problems

Practice more problems similar to Check if Grid Satisfies Conditions.

Review your practice with PhantomCodeAI

After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.