Arrange crops into connected regions of a garden
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.
No answer yet. Write the first one; the best answer gets endorsed.
