← Questions

Arrange crops into connected regions of a garden

0
GoogleCodingLast asked Aug 2026

A rectangular garden has N rows and M columns, and there are K crop types. Crop i must take exactly count[i] cells, and the counts add up to N * M. Return any planting that uses every cell once and keeps each crop in a single connected region.

A later part asks the same for a garden made of two squares instead of one rectangle.

Write and test your solution herePython in your browser, the question's tests level by level, saved for you.Sign in to start coding