LC 85

Maximal Rectangle

Hard · LC 1–100

arraydynamic-programmingmatrixmonotonic-stackstack
Free

Candidate solution routes

Primary

Grid dynamic programming

Free

Invariant: When cell (r,c) is processed, every predecessor state already meets its definition; the new state aggregates every legal way to enter the cell exactly as required.

candidate confidence: 0.607 · metadata_only

Alternate 1

Monotonic Stack for Nearest Greater/Smaller

Free

Invariant: Stack indexes increase, their values are monotone in the chosen direction, and every stored index has not yet encountered a right-side item that resolves it.

candidate confidence: 0.735 · metadata_only

Alternate 2

Stack-Based State Simulation

Free

Invariant: After each input prefix, frames from bottom to top are exactly the unfinished contexts in opening order, and the top is the only context directly affected next.

candidate confidence: 0.488 · metadata_only

How to use this page

Read the statement and constraints first, then validate recognition signals, invariant, and complexity. Candidate score is not correctness evidence.