Practice Largest Rectangle in Histogram
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
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.
Source: Largest Rectangle in Histogram on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
Input
heights = [2,1,5,6,2,3]
Output
10
# Example 2
Input
heights = [2,4]
Output
4
Constraints
1 <= heights.length <= 10^5
0 <= heights[i] <= 10^4
Related LeetCode Problems
Practice more problems similar to Largest Rectangle in Histogram.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.