Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f38ff8f

Browse files
authored
Update 84.largest-rectangle-in-histogram.md
1 parent 7a8a1b8 commit f38ff8f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

problems/84.largest-rectangle-in-histogram.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,8 @@ class Solution:
181181
for i in range(n + 2):
182182
while st and heights[st[-1]] > heights[i]:
183183
a = heights[st[-1]]
184-
# 如果没有前面的哨兵,这里可能会越界。
185184
st.pop()
185+
# 如果没有前面的哨兵,这里的 st[-1] 可能会越界。
186186
ans = max(ans, a * (i - 1 - st[-1]))
187187
st.append(i)
188188
return ans

0 commit comments

Comments
 (0)