Question bank › Matrix
Dsa Matrix Hard

Max Rectangular Area in Histogram Matrix

Given a binary matrix filled with 0s and 1s, find the area of the largest rectangle containing only 1s and return its area. You can assume that all rows are of equal length. Input: - The first line contains an integer m (number of rows) and n (number of columns), - The next m lines each contain n integers (0 or 1) representing the matrix. Output: - An integer representing the area of the largest rectangle. Example: Input: 3 4 1 0 1 0 1 0 1 1 1 1 1 1 Output: 6

Key concepts

matrixhistogramarea

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.