Find Zero Cells in a 2×2 Grid
Problem statement
You are given an integer grid with exactly two rows and two columns. Find every cell whose value equals 0.
For this exercise, assume the result contains zero-based coordinate pairs [row, column], ordered by increasing row and then increasing column. Return an empty array when the grid contains no zeros. Inspect cells independently; neighboring zeros still produce separate coordinate pairs.
Function
findZeroCells(grid: int[][]) → int[][]Examples
Example 1
grid = [[0,4],[3,0]]return = [[0,0],[1,1]]The zero cells are the top-left and bottom-right cells.
Example 2
grid = [[5,1],[9,2]]return = []Every value is nonzero, so the result is empty.
Example 3
grid = [[0,0],[0,0]]return = [[0,0],[0,1],[1,0],[1,1]]All four cells are reported in row-major order.
Constraints
grid.length = 2.grid[0].length = grid[1].length = 2.-10^9 <= grid[row][column] <= 10^9.