Skip to content

Commit 31d16d6

Browse files
authored
Merge pull request CyC2018#135 from HustCoderHu/master
Leetcode 题解
2 parents 8fac4c2 + 7d7133d commit 31d16d6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

notes/Leetcode 题解.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* [动态规划](#动态规划)
1616
* [斐波那契数列](#斐波那契数列)
1717
* [最长递增子序列](#最长递增子序列)
18-
* [最长公共子系列](#最长公共子系列)
18+
* [最长公共子序列](#最长公共子序列)
1919
* [0-1 背包](#0-1-背包)
2020
* [数组区间](#数组区间)
2121
* [字符串编辑](#字符串编辑)
@@ -1960,7 +1960,7 @@ public int wiggleMaxLength(int[] nums) {
19601960
}
19611961
```
19621962

1963-
### 最长公共子系列
1963+
### 最长公共子序列
19641964

19651965
对于两个子序列 S1 和 S2,找出它们最长的公共子序列。
19661966

@@ -1970,7 +1970,7 @@ public int wiggleMaxLength(int[] nums) {
19701970

19711971
② 当 S1<sub>i</sub> != S2<sub>j</sub> 时,此时最长公共子序列为 S1 的前 i-1 个字符和 S2 的前 j 个字符最长公共子序列,与 S1 的前 i 个字符和 S2 的前 j-1 个字符最长公共子序列,它们的最大者,即 dp[i][j] = max{ dp[i-1][j], dp[i][j-1] }。
19721972

1973-
综上,最长公共子系列的状态转移方程为
1973+
综上,最长公共子序列的状态转移方程为
19741974

19751975
<div align="center"><img src="https://latex.codecogs.com/gif.latex?dp[i][j]=\left\{\begin{array}{rcl}dp[i-1][j-1]&&{S1_i==S2_j}\\max(dp[i-1][j],dp[i][j-1])&&{S1_i<>S2_j}\end{array}\right."/></div> <br>
19761976

0 commit comments

Comments
 (0)