For each bar, expand left and right to find how far you can go while heights stay >= current bar's height. Calculate area.
For bar at index i, you might scan almost the entire array to find the boundaries. That's per bar, total.
Can you precompute the boundaries for all bars efficiently?