The objective of this article is to solve the maximal rectangle problem using Monotonic queue. In this problem we are given a matrix consisting of only 0's and 1's, we need to find the largest rectangle consisting of only 1's and return its area.
Monotonic queue approach
In this method, we are going to construct a histogram and find the largest rectangle area that can be formed in the histogram for each row and compare these values to find the maximum rectangular area that can be formed in the g...
Published on April 21, 2021 00:14