Problem
Ask
Submissions

Problem: Largest Rectangle in Histogram

Medium
30 min
Explore methods to identify the largest rectangle within a histogram represented by an array of bar heights. Learn to apply an optimal O(n) time and O(n) space solution, enhancing your problem-solving skills for coding interviews and algorithm challenges.

Statement

Given an array of integers, heights, that represents the heights of bars in a histogram, find the area of the largest rectangle in the histogram, where the rectangle has a constant width of 11 unit for each bar.

Constraints

  • 11 \leq heights.length 103\leq 10^3
  • 00 \leq heights[i] 104\leq 10^4
Problem
Ask
Submissions

Problem: Largest Rectangle in Histogram

Medium
30 min
Explore methods to identify the largest rectangle within a histogram represented by an array of bar heights. Learn to apply an optimal O(n) time and O(n) space solution, enhancing your problem-solving skills for coding interviews and algorithm challenges.

Statement

Given an array of integers, heights, that represents the heights of bars in a histogram, find the area of the largest rectangle in the histogram, where the rectangle has a constant width of 11 unit for each bar.

Constraints

  • 11 \leq heights.length 103\leq 10^3
  • 00 \leq heights[i] 104\leq 10^4