easyArrayMatrix 0 views

Check if Grid Satisfies Conditions

You are given a 2D matrix grid of size m x n.

You are given a 2D matrix grid of size m x n. You need to check if each cell grid[i][j] is:

Return true if all the cells satisfy these conditions, otherwise, return false.

Check if Grid Satisfies Conditions diagram

Example 1

Input: grid = [[1,0,2],[1,0,2]]

Output: true

Explanation: All the cells in the grid satisfy the conditions.

Example 2

Input: grid = [[1,1,1],[0,0,0]]

Output: false

Explanation: All cells in the first row are equal.

Example 3

Input: grid = [[1],[2],[3]]

Output: false

Explanation: Cells in the first column have different values.

Constraints

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

Hints

Companies

No companies reported yet.

Discussion

Sign in to join the discussion.

Loading discussion...

Test results

No test cases yet.