Question bank › Monotonic Stack
Dsa Monotonic Stack Medium

Histogram Area

You are given a histogram represented by an array of heights. Write a function that calculates the largest rectangle that can be formed in the histogram. Input: - A single line of space-separated integers representing the heights of the histogram bars. Output: - A single integer representing the area of the largest rectangle. Example: Input: 2 1 5 6 2 3 Output: 10

Key concepts

monotonic_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
Part of InterviewLab's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.