Dark Mode
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
A move consists of walking from one land square 4-directionally to another land square, or off
Return the number of land squares in the grid for which we cannot walk off the boundary of the
Example 1:
Input: [[0,0,0,0],[1,0,1,0],[0,1,1,0],[0,0,0,0]] Output: 3 Explanation: There are three 1s
Input: [[0,1,1,0],[0,0,1,0],[0,0,1,0],[0,0,0,0]] Output: 0 Explanation: All 1s are either on
Note:
1 <= A.length <= 500 1 <= A[i].length <= 500 0 <= A[i][j] <= 1 All rows have the same size.