Given a 2D binary matrix filled with
1’s, find the largest rectangle containing all ones and return its area.
Bonus if you can solve it in O(n^2) or less.
A : [ 1 1 1 0 1 1 1 0 0 ] Output : 4 As the max area rectangle is created by the 2x2 rectangle created by (0,1), (0,2), (1,1) and (1,2)
NOTE: You only need to implement the given function. Do not read input, instead use the arguments to the function. Do not print the output, instead return values as specified. Still have a doubt? Checkout Sample Codes for more details.