Hello CF!
I'm preparing for the next hashcode by the following prev. problem:
Given a pizza of size R x C
with cells containing either mushrooms or tomatoes as shown bellow:
We are given 2 parameters: L
and H
. The goal is to split the pizza into rectangular slices such that each rectangle contains at least L
cells of mushrooms and at least L
of tomatoes. Furthermore, each split rectangle should contain at most H
cells in total. Note that not all of the pizza needs to be contained in the split. The goal is to maximize the number of cells
So in the example above, L=1
and H=6
so in this case The ideal split will be:
So each split contains at least 1 mushroom and at least 1 tomato, and each split contains at most 6 cells. I am not sure how to approach the solution to this problem? Which topics should I read about to understand how to solve such a problem?