plan of zeros and ones: 1 is farmland and 0 is forest. The farmland forms separate fields, and every field is a solid rectangle. Two different fields never share a side: there is always forest between them (touching diagonally is possible).
For each field return [r1, c1, r2, c2], where (r1, c1) is the row and column of its top-left cell and (r2, c2) of its bottom-right cell (0-based).
The fields may be listed in any order. If there is no farmland, return an empty list.plan=[[1, 1, 0, 1], [1, 1, 0, 0], [0, 0, 0, 1]] → [[0, 0, 1, 1], [0, 3, 0, 3], [2, 3, 2, 3]]
Three fields: a 2×2 square with corners (0, 0) and (1, 1), plus two single-cell fields at (0, 3) and (2, 3).
plan=[[0, 1, 1, 1]] → [[0, 1, 0, 3]]
One field in row 0, from column 1 to column 3.
plan=[[0, 0], [0, 0]] → []
All forest, no fields.
len(plan), len(plan[0]) ≤ 300plan=[[1, 1, 0, 1], [1, 1, 0, 0], [0, 0, 0, 1]]
[[0, 0, 1, 1], [0, 3, 0, 3], [2, 3, 2, 3]]
Run checks the first 3 tests in your browser. Submit checks all 49 tests on the server, hidden ones included.