diff --git a/problems/0392.判断子序列.md b/problems/0392.判断子序列.md index 12d3fa48..cb9323c8 100644 --- a/problems/0392.判断子序列.md +++ b/problems/0392.判断子序列.md @@ -240,26 +240,45 @@ function isSubsequence(s: string, t: string): boolean { ### Go: +二维DP: + ```go func isSubsequence(s string, t string) bool { - dp := make([][]int,len(s)+1) - for i:=0;i= 1; j -- { + if t[i - 1] == s[j - 1] { + dp[j] = dp[j - 1] + 1 + } + } + } + return dp[len(s)] == len(s) +} +``` + + +### Rust: ```rust impl Solution {