Dsa
Monotonic Stack
Medium
Largest Rectangle in Skyline
You are given a list of heights representing the skyline of buildings. Your task is to compute the area of the largest rectangle that can be formed under the skyline.
Input format:
- A single line containing space-separated integers, representing the heights of the buildings.
Output format:
- A single integer representing the maximum area of the rectangle.
Example:
Input:
1 3 2 5 4
Output:
8
Key concepts
monotonic_stackgeometry
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