当前位置:网站首页>leetcode:85. Max rectangle

leetcode:85. Max rectangle

2022-06-24 06:40:00 Oceanstar's learning notes

Title source

Title Description

 Insert picture description here
 Insert picture description here

title

The matrix is as follows :
 Insert picture description here

Prepare a histogram array

  • The submatrix must be in the second order 0 In the case of rows as foundations ( Look up ), Which submatrix contains 1 most
    • obtain [1、1、1、1、1], And then we get maxArea=1+1+1+1+1=5
  • The submatrix must be in the second order 1 In the case of rows as foundations ( Look up ), Which submatrix contains 1 most
    • obtain [2、0、2、2、2], And then we get maxArea=2+2+2=6
  • The submatrix must be in the second order 2 In the case of rows as foundations ( Look up ), Which submatrix contains 1 most
    • obtain [3、1、3、0、3], And then we get maxArea=1+1+1=3
  • The submatrix must be in the second order 3 In the case of rows as foundations ( Look up ), Which submatrix contains 1 most
    • obtain [4、2、4、1、4], And then we get maxArea=2+2+2=6

Get maxArea You can refer to leetcode:84. The largest rectangle in the histogram

原网站

版权声明
本文为[Oceanstar's learning notes]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/175/202206240017131425.html