Given an array of integers heights representing a histogram's bar heights where each bar has width 1, return the area of the largest rectangle in the histogram.
Input: heights = [2,1,5,6,2,3]
Output: 10
Explanation: Formed by heights 5 and 6 with width 2.
Topics: stack, arrays
Asked by: Amazon, Google, Meta, Microsoft
Time complexity: O(n). Space complexity: O(n).