Maximal Rectangle · Compound Engineer

Maximal Rectangle

Find the largest rectangle of 1s in a binary matrix. Turn each row into a histogram of consecutive 1s above it, then solve Largest Rectangle in Histogram with a monotonic stack.

DSAProHardStep-through playerBy Aayush OstwalSolve on LeetCode ↗
Spotted a mistake in this lesson?Report an issue →