Question bank › Stack
Dsa Stack Medium

Histogram Rectangle Analyzer

You are given an array of integers where each integer represents the height of a histogram bar. Your task is to find the area of the largest rectangle that can be formed using these bars, where the rectangle must extend across contiguous bars in the histogram. The solution must run efficiently in linear time. Implement a function that reads from standard input and prints the area of the largest rectangle. ### Example: Input: [2,1,5,6,2,3] Output: 10 ### Input format: A single line containing a list of non-negative integers representing heights of histogram bars, e.g. [2,1,5,6,2,3]. Maximum length of the array is 100. ### Output format: A single integer representing the area of the largest rectangle.

Key concepts

stackhistogramrectangle

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