NumPy allowed · plain Python earns 10 bonus points
Compute the maximal rectangular area bounding contiguous histogram columns in strict linear time.
Implement largest_rectangle_area(heights): find the area of the largest rectangle that can be formed within the given histogram bar heights. Must run in O(n) time using a monotonic increasing stack.
largest_rectangle_area(heights: list[int]) -> int