the histogram is given as list example {2,2,4,2,1,1,1}
Sigiloso
12 de jan. de 2014
For each distinct value (1,2,4) pass initial array trying to find maximum continious region covering this value (area is value * region-length). Pass complexity is O(N^2). Copied list could be sorted (N log N) in order to get distinct values.
Sigiloso
29 de mar. de 2014
It is similar to grouping items in a sorted array. Keep walking along the array and everytime the height changes, look back to see how many had the same height and compute area.
Keep track of max area.