Dsa
Monotonic Stack
Medium
Max Area of Rectangles
Given a list of integers representing the heights of rectangles in a histogram, calculate the area of the largest rectangle that can be formed under the histogram.
Input format:
- A single line containing space-separated integers, representing the heights.
Output format:
- A single integer representing the maximum area.
Example:
Input:
2 1 5 6 2 3
Output:
10
Key concepts
monotonic_stackarea
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