Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit f0b07d9

Browse files
author
robot
committed
chore: 1793 更详细一点
1 parent 5a384e2 commit f0b07d9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

‎problems/1793.maximum-score-of-a-good-subarray.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ https://leetcode.cn/problems/maximum-score-of-a-good-subarray/description/
5454

5555
容易想到的是从左向右遍历用一次单调栈,求每个位置 i 右侧第一个比它小的位置 right。再从右向左遍历用一次单调栈,求每个位置 i 左侧第一个比它小的位置 left。这样就可以求出每个位置的 left 和 right。
5656

57-
不过我们用一个单调栈*从左向右遍历***也可以轻松完成。从左向右计算右边第一个比它小的简单,那么如果求左边第一个比它小的呢?举个例子你就明白了。比如 stack 目前是 [0,2,3](stack 中存的是索引)。那么对于 stack 中的 3 来说,前面严格小于它的就是 stack 中它左侧相邻的索引 2。
57+
不过我们用一个单调栈**从左向右遍历**也可以轻松完成。从左向右计算右边第一个比它小的简单,那么如果求左边第一个比它小的呢?举个例子你就明白了。比如 stack 目前是 [0,2,3](stack 中存的是索引)。那么对于 stack 中的 3 来说,前面严格小于它的就是 stack 中它左侧相邻的索引 2。
5858

5959
## 关键点
6060

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /