2020-07-10 11:35:22 -04:00
|
|
|
CLASS net/minecraft/class_5459
|
2021-02-02 12:52:00 -05:00
|
|
|
METHOD method_30576 findLargestRectangle ([I)Lcom/mojang/datafixers/util/Pair;
|
|
|
|
COMMENT Finds the largest rectangle within a histogram, where the vertical bars each have
|
|
|
|
COMMENT width 1 and height specified in {@code heights}.
|
|
|
|
COMMENT
|
2021-02-07 08:30:35 -05:00
|
|
|
COMMENT @implNote This implementation solves the problem using a stack. The
|
2021-02-02 12:52:00 -05:00
|
|
|
COMMENT stack maintains a collection of height limits of rectangles that may grow as the
|
|
|
|
COMMENT array iteration continues. When a new height is encountered, each position {@code p}
|
|
|
|
COMMENT in the stack would be popped if the rectangle with height limit at position {@code
|
|
|
|
COMMENT p} can no longer extend right. The popped rectangle becomes the return value if it
|
|
|
|
COMMENT has a larger area than the current candidate.
|
|
|
|
COMMENT
|
|
|
|
COMMENT <p>When the rectangle area is calculated, the range is between {@code p0 + 1}, where
|
|
|
|
COMMENT {@code p0} is the current top of stack after popping rectangles that can no longer
|
|
|
|
COMMENT extend, and the current iterated position {@code i}.
|
|
|
|
COMMENT
|
|
|
|
COMMENT @return the base of the rectangle as an inclusive range and the height of the
|
|
|
|
COMMENT rectangle packed in a pair
|
2021-02-07 08:30:35 -05:00
|
|
|
COMMENT @see <a href="https://leetcode.com/problems/largest-rectangle-in-histogram">Largest
|
|
|
|
COMMENT Rectangle in Histogram - LeetCode</a>
|
2021-02-02 12:52:00 -05:00
|
|
|
ARG 0 heights
|
|
|
|
COMMENT the heights of bars in the histogram
|
2020-07-10 11:35:22 -04:00
|
|
|
CLASS class_5461 IntBounds
|
|
|
|
FIELD field_25939 min I
|
|
|
|
FIELD field_25940 max I
|
|
|
|
METHOD <init> (II)V
|
|
|
|
ARG 1 min
|
|
|
|
ARG 2 max
|