Dsa
Monotonic Stack
Easy
Max Rectangle Area in Histogram
Given an array of integers representing the heights of barrels in a histogram, calculate the maximum area of a rectangle that can be formed by these barrels.
Input Format:
- A single line containing n integers representing the heights, separated by spaces.
Output Format:
- A single integer representing the maximum rectangle area.
Example:
Input:
2 1 5 6 2 3
Output:
10
Key concepts
monotonic_stackgeometryarrays
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now