From 42924684ee95003d0f21a80662886f2e88d147ec Mon Sep 17 00:00:00 2001 From: lfeng Date: Fri, 8 Oct 2021 10:10:48 +0800 Subject: [PATCH 1/4] =?UTF-8?q?Update=200028.=E5=AE=9E=E7=8E=B0strStr.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- problems/0028.实现strStr.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/problems/0028.实现strStr.md b/problems/0028.实现strStr.md index 2a7b9cfa..1c200a71 100644 --- a/problems/0028.实现strStr.md +++ b/problems/0028.实现strStr.md @@ -215,7 +215,7 @@ next数组就可以是前缀表,但是很多实现都是把前缀表统一减 其实**这并不涉及到KMP的原理,而是具体实现,next数组即可以就是前缀表,也可以是前缀表统一减一(右移一位,初始位置为-1)。** -后面我会提供两种不同的实现代码,大家就明白了了。 +后面我会提供两种不同的实现代码,大家就明白了。 # 使用next数组来匹配 From 9badd38a38a0cccd26cc8c0ef6f0ac732a1c2df5 Mon Sep 17 00:00:00 2001 From: lfeng Date: Fri, 8 Oct 2021 10:11:31 +0800 Subject: [PATCH 2/4] =?UTF-8?q?Update=200042.=E6=8E=A5=E9=9B=A8=E6=B0=B4.m?= =?UTF-8?q?d?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- problems/0042.接雨水.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/problems/0042.接雨水.md b/problems/0042.接雨水.md index bc397863..25899e38 100644 --- a/problems/0042.接雨水.md +++ b/problems/0042.接雨水.md @@ -204,7 +204,7 @@ public: 2. 使用单调栈内元素的顺序 -从大到小还是从小打到呢? +从大到小还是从小到大呢? 从栈头(元素从栈头弹出)到栈底的顺序应该是从小到大的顺序。 From ff7c57a7d00eff78570847e5f8e487c627c8f766 Mon Sep 17 00:00:00 2001 From: lfeng Date: Fri, 8 Oct 2021 10:12:08 +0800 Subject: [PATCH 3/4] =?UTF-8?q?Update=200225.=E7=94=A8=E9=98=9F=E5=88=97?= =?UTF-8?q?=E5=AE=9E=E7=8E=B0=E6=A0=88.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- problems/0225.用队列实现栈.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/problems/0225.用队列实现栈.md b/problems/0225.用队列实现栈.md index 5adba07f..d9819626 100644 --- a/problems/0225.用队列实现栈.md +++ b/problems/0225.用队列实现栈.md @@ -112,7 +112,7 @@ public: # 优化 -其实这道题目就是用一个队里就够了。 +其实这道题目就是用一个队列就够了。 **一个队列在模拟栈弹出元素的时候只要将队列头部的元素(除了最后一个元素外) 重新添加到队列尾部,此时在去弹出元素就是栈的顺序了。** From 9ba63ac729951639b17433f673c447a1d1185255 Mon Sep 17 00:00:00 2001 From: lfeng Date: Sat, 9 Oct 2021 15:46:44 +0800 Subject: [PATCH 4/4] =?UTF-8?q?Update=200042.=E6=8E=A5=E9=9B=A8=E6=B0=B4.m?= =?UTF-8?q?d?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- problems/0042.接雨水.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/problems/0042.接雨水.md b/problems/0042.接雨水.md index 25899e38..b75865d7 100644 --- a/problems/0042.接雨水.md +++ b/problems/0042.接雨水.md @@ -143,7 +143,7 @@ public: 当前列雨水面积:min(左边柱子的最高高度,记录右边柱子的最高高度) - 当前柱子高度。 -为了的到两边的最高高度,使用了双指针来遍历,每到一个柱子都向两边遍历一遍,这其实是有重复计算的。我们把每一个位置的左边最高高度记录在一个数组上(maxLeft),右边最高高度记录在一个数组上(maxRight)。这样就避免了重复计算,这就用到了动态规划。 +为了得到两边的最高高度,使用了双指针来遍历,每到一个柱子都向两边遍历一遍,这其实是有重复计算的。我们把每一个位置的左边最高高度记录在一个数组上(maxLeft),右边最高高度记录在一个数组上(maxRight)。这样就避免了重复计算,这就用到了动态规划。 当前位置,左边的最高高度是前一个位置的左边最高高度和本高度的最大值。