LeetCode 85. Maximal Rectangle

Original Description on LeetCode is : Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing all ones and return its area.

This description was wrong. It should be "Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle containingONLY ones and return its area."

suppose we have a matrix:

0, 0, 1, 0                                                               

0, 0, 0, 1                                                               

0, 1, 1, 1    ---> largest area should be                 

0, 0, 1, 1                                                                  


0, 0, 1, 0

0, 0, 0, 1

0, 1, 1, 1

0, 1, 1, 1   --> maxArea is 4.

Will update the solution tomorrow. 奋斗

你可能感兴趣的:(LeetCode 85. Maximal Rectangle)