Determine whether a small grid satisfies a set of local cell-by-cell constraints.
Given an grid of integers, check whether it satisfies a set of local conditions involving each cell and its neighboring cells.
In this problem, you inspect the grid directly and verify that every required condition holds. The task is primarily about careful iteration over the matrix and correctly handling boundaries when comparing neighboring values.
Return whether the grid satisfies all conditions.
true if the grid satisfies all required conditions.false.Example 1
Input
grid = [[1,0,1],[1,1,0]]
Output
true
Explanation
All cells satisfy the required local checks for this example grid.
Premium problem context
Premium adds guided hints, editorial links, similar variants, discussion resources, and concept maps so you can understand why a problem matters, not just solve it once.