项目作者: bensonlin321

项目描述 :
84. Largest Rectangle in Histogram
高级语言: C++
项目地址: git://github.com/bensonlin321/84-Largest-Rectangle-in-Histogram.git


84-Largest-Rectangle-in-Histogram

  1. Largest Rectangle in Histogram
  • Given n non-negative integers representing the histogram’s bar height where the width of each bar is 1, find the area of largest rectangle in the histogram.
  1. 6
  2. 5 _
  3. _| |
  4. | | | 3
  5. 2 | | |2 _
  6. _ 1| | |_| |
  7. | |_| | | | |
  8. |_|_|_|_|_|_|
  9. Above is a histogram where width of each bar is 1, given height = [2,1,5,6,2,3].
  10. 6
  11. 5 _
  12. _| |
  13. |/|/| 3
  14. 2 |/|/|2 _
  15. _ 1|/|/|_| |
  16. | |_|/|/| | |
  17. |_|_|/|/|_|_|
  18. The largest rectangle is shown in the shaded area, which has area = 10 unit.
  19. - Example:
  20. Input: [2,1,5,6,2,3]
  21. Output: 10