Leetcode: 84. Largest Rectangle in Histogram
Given an array of integers heights representing the histogram's bar height where the width of each bar is 1, return the area of the largest rectangle in the histogram. Refer to this link for the diagram: https://leetcode.com/problems/largest-rectangle-in-histogram.
Time Complexity: O(N) It's an implementation of stack data structure and quite a popular question on leetcode. This is not the best solution in terms of memory and runtime, this solution could be optimized I believe.
6
6
0