Hi!I'm not sure if (i don't know how to explain this) "slices" of matrix contains only stripes or few rectangulars ? For example:
111111122221122221122221122221111111
I don't understand the question. You should care only about maximum sum, not the structure of "slices".