Leetcode 85. Maximal Rectangle

来源:互联网 发布:行业大数据 编辑:程序博客网 时间:2024/05/11 02:44

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

Analysis:需要结合Stack,进行压栈和出栈等操作。

最有技巧的一点就是利用Dynamic Programming, 统计在二维数组中连续一的个数。然后相似得使用

84. Largest Rectangle in Histogram 来统计面积。

0 0
原创粉丝点击