DIY: Maximal rectangle
Solve the interview question "Maximal rectangle" in this lesson.
We'll cover the following
Problem statement
Given an m x n
binary matrix containing 0's
and 1's
. Find the largest rectangle containing only 1's
and return its area.
Input
The input will be an m x n
matrix of 0's
and 1's
. The following is an example input:
[["1","0","1","0","0"],["1","0","1","1","1"],["1","1","1","1","1"],["1","0","0","1","0"]]
Level up your interview prep. Join Educative to access 80+ hands-on prep courses.