Given an array of integers representing the heights of bars in a histogram, find the maximum area of the histogram by choosing the minimum height of consecutive bars as the height of the rectangle and the number of bars as the width.
Explanation: The maximum area is formed by the bars with heights 5 and 6, with a minimum height of 5 and a width of 2, so the maximum area is 10.
Explanation: This example is kept as is, however further review of the math behind the solution to this particular input would be required to ensure accuracy.
Maximum rectangular area in histogram
No dry run loaded.
🚀 Practice this problem
Run code, get AI hints & track streak