Tree Planting on a Grid (no adjacent trees)
Given an m x n grid grid representing land:
1means an existing tree0means empty
You may plant new trees on empty cells, subject to:
- No two trees (existing or newly planted) may be ad...
Example
Unlock to view complete problem details
and practice with sample input/output
Was this article helpful?
View Test Cases & Run Code requires membership
Standard Input
Execution Result:
