Dsa
Stack
Medium
Maximal Rectangular Area in Histogram
You are given a list of non-negative integers representing the heights of a histogram. Write a function to compute the area of the largest rectangle that can be formed under the histogram.
Input Format:
A single line of space-separated integers representing the heights of the histogram.
Output Format:
Print the area of the largest rectangle under the histogram.
Example:
Input:
2 1 5 6 2 3
Output:
10
Key concepts
stackarraygeometry
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