Skip to content

Commit 04e7ef8

Browse files
committed
0072, 0392, 0583 Reworded.
1 parent af133eb commit 04e7ef8

3 files changed

+7
-7
lines changed

0072-edit-distance.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ These five steps are a pattern for solving dynamic programming problems.
4343
2. Determine the `dp` array's initial value
4444
* Use an example:
4545
```
46-
After initialized, the 'dp' array would be:
46+
After initialization, the 'dp' array would be:
4747
# r o s
4848
# 0 1 2 3 # dp[0]
4949
# h 1 0 0 0
@@ -67,7 +67,7 @@ These five steps are a pattern for solving dynamic programming problems.
6767
# e 5 4 4 3
6868
```
6969
* When analyzing the sample `dp` grid, remember there are three important points which you should pay special attention to: `dp[i - 1][j - 1]`, `dp[i - 1][j]` and `dp[i][j - 1]`. The current `dp[i][j]` often depends on them.
70-
* If we need to use `dp[i - 1][j]` or `dp[i][j - 1]`, and the question is also true in reverse, then we probably need to use both of them.
70+
* If the question is also true in reverse (swap `word1` and `word2`), and we need to use `dp[i - 1][j]` or `dp[i][j - 1]`, then we probably need to use both of them.
7171
* We can derive the `Recurrence Formula`:
7272
```python
7373
if word1[i - 1] == word2[j - 1]

0392-is-subsequence.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
LeetCode problem: [392. Is Subsequence](https://leetcode.com/problems/is-subsequence/)
33

44
## LeetCode problem description
5-
> Given two strings `s` and `t`, return `true` if s is a **subsequence** of `t`, or `false` otherwise.
5+
> Given two strings `s` and `t`, return `true` if `s` is a **subsequence** of `t`, or `false` otherwise.
66
77
A **subsequence** of a string is a new string that is formed from the original string by deleting some (can be none) of the characters without disturbing the relative positions of the remaining characters. (i.e., `"ace"` is a subsequence of `"abcde"` while `"aec"` is not).
88

@@ -31,7 +31,7 @@ These five steps are a pattern for solving dynamic programming problems.
3131
2. Determine the `dp` array's initial value
3232
* Use an example:
3333
```
34-
After initialized, the 'dp' array would be:
34+
After initialization, the 'dp' array would be:
3535
s = "abc", t = "ahbgdc"
3636
# a h b g d c
3737
# T T T T T T T # dp[0]
@@ -52,7 +52,7 @@ These five steps are a pattern for solving dynamic programming problems.
5252
# c F F F F F F T
5353
```
5454
* When analyzing the sample `dp` grid, remember there are three important points which you should pay special attention to: `dp[i - 1][j - 1]`, `dp[i - 1][j]` and `dp[i][j - 1]`. The current `dp[i][j]` often depends on them.
55-
* If we need to use `dp[i - 1][j]` or `dp[i][j - 1]`, and the question is also true in reverse, then we probably need to use both of them.
55+
* If the question is also true in reverse (swap `s` and `t`), and we need to use `dp[i - 1][j]` or `dp[i][j - 1]`, then we probably need to use both of them.
5656
* We can derive the `Recurrence Formula`:
5757
```
5858
if s[i - 1] == t[j - 1]

0583-delete-operation-for-two-strings.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ These five steps are a pattern for solving dynamic programming problems.
3131
2. Determine the `dp` array's initial value
3232
* Use an example:
3333
```
34-
After initialized, the 'dp' array would be:
34+
After initialization, the 'dp' array would be:
3535
# e a t
3636
# 0 1 2 3 # dp[0]
3737
# s 1 0 0 0
@@ -50,7 +50,7 @@ These five steps are a pattern for solving dynamic programming problems.
5050
# a 3 2 1 2
5151
```
5252
* When analyzing the sample `dp` grid, remember there are three important points which you should pay special attention to: `dp[i - 1][j - 1]`, `dp[i - 1][j]` and `dp[i][j - 1]`. The current `dp[i][j]` often depends on them.
53-
* If we need to use `dp[i - 1][j]` or `dp[i][j - 1]`, and the question is also true in reverse, then we probably need to use both of them.
53+
* If the question is also true in reverse (swap `word1` and `word2`), and we need to use `dp[i - 1][j]` or `dp[i][j - 1]`, then we probably need to use both of them.
5454
* We can derive the `Recurrence Formula`:
5555
```python
5656
if word1[i - 1] == word2[j - 1]

0 commit comments

Comments
 (0)