feat(content): more test cases
This commit is contained in:
@@ -9,6 +9,32 @@ categories:
|
||||
patterns:
|
||||
- monotonic-stack
|
||||
|
||||
function_signature: "def largest_rectangle_area(heights: list[int]) -> int:"
|
||||
|
||||
test_cases:
|
||||
visible:
|
||||
- input: { heights: [2, 1, 5, 6, 2, 3] }
|
||||
expected: 10
|
||||
- input: { heights: [2, 4] }
|
||||
expected: 4
|
||||
- input: { heights: [1, 1] }
|
||||
expected: 2
|
||||
hidden:
|
||||
- input: { heights: [1] }
|
||||
expected: 1
|
||||
- input: { heights: [0] }
|
||||
expected: 0
|
||||
- input: { heights: [2, 1, 2] }
|
||||
expected: 3
|
||||
- input: { heights: [1, 2, 3, 4, 5] }
|
||||
expected: 9
|
||||
- input: { heights: [5, 4, 3, 2, 1] }
|
||||
expected: 9
|
||||
- input: { heights: [3, 6, 5, 7, 4, 8, 1, 0] }
|
||||
expected: 20
|
||||
- input: { heights: [4, 2, 0, 3, 2, 5] }
|
||||
expected: 6
|
||||
|
||||
description: |
|
||||
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*.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user