Farmer Frenzy approach problem

how to solve farmer frenzy problem?suggest me some approach

The problem can be reduced to finding the maximum rectangle area in a histogram, multiple times.

After each row, you calculate the histogram built until that row, and that calculate the maximum area rectangle in that histogram.

For better understanding , refer this -: