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

[pull] master from youngyangyang04:master #13

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
pull merged 19 commits into AlgorithmAndLeetCode:master from youngyangyang04:master
Jun 13, 2022
Merged
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
568a569
添加(1143.最长公共子序列.md):增加typescript版本
xiaofei-2020 May 19, 2022
b3335f7
添加 763.划分字母区间 补充思路的Java代码实现
May 19, 2022
30c1be1
添加(1035.不相交的线.md):增加typescript版本
xiaofei-2020 May 19, 2022
4d2b80c
添加(0053.最大子序和动态规划.md):增加typescript版本
xiaofei-2020 May 19, 2022
8759349
添加(0392.判断子序列.md):增加typescript版本
xiaofei-2020 May 19, 2022
4eefc54
添加(0115.不同的子序列.md):增加typescript版本
xiaofei-2020 May 20, 2022
58c4ad4
添加(0583.两个字符串的删除操作.md):增加typescript版本
xiaofei-2020 May 20, 2022
fa3a45c
添加(0072.编辑距离.md):增加typescript版本
xiaofei-2020 May 20, 2022
be7d6e1
添加 0226.翻转二叉树.md Scala版本
wzqwtt May 20, 2022
81d4685
添加 0101.对称二叉树.md Scala版本
wzqwtt May 20, 2022
7163601
Merge pull request #1358 from xiaofei-2020/dp44
youngyangyang04 Jun 12, 2022
a054544
Merge pull request #1359 from zhouchaoyu1/master
youngyangyang04 Jun 13, 2022
6b8692c
Merge pull request #1361 from xiaofei-2020/dp45
youngyangyang04 Jun 13, 2022
3071e3b
Merge pull request #1362 from xiaofei-2020/dp46
youngyangyang04 Jun 13, 2022
7886da3
Merge pull request #1364 from xiaofei-2020/dp47
youngyangyang04 Jun 13, 2022
9727003
Merge pull request #1366 from xiaofei-2020/dp48
youngyangyang04 Jun 13, 2022
6d130e7
Merge pull request #1367 from xiaofei-2020/dp49
youngyangyang04 Jun 13, 2022
f9aeae5
Merge pull request #1368 from xiaofei-2020/dp50
youngyangyang04 Jun 13, 2022
e9cdb3e
Merge pull request #1369 from wzqwtt/tree06
youngyangyang04 Jun 13, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
添加(0392.判断子序列.md):增加typescript版本
  • Loading branch information
xiaofei-2020 committed May 19, 2022
commit 8759349af0001c6ee2f05ceece9cc0e331fbc08a
25 changes: 25 additions & 0 deletions problems/0392.判断子序列.md
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,32 @@ const isSubsequence = (s, t) => {
};
```

TypeScript:

```typescript
function isSubsequence(s: string, t: string): boolean {
/**
dp[i][j]: s的前i-1个,t的前j-1个,最长公共子序列的长度
*/
const sLen: number = s.length,
tLen: number = t.length;
const dp: number[][] = new Array(sLen + 1).fill(0)
.map(_ => new Array(tLen + 1).fill(0));
for (let i = 1; i <= sLen; i++) {
for (let j = 1; j <= tLen; j++) {
if (s[i - 1] === t[j - 1]) {
dp[i][j] = dp[i - 1][j - 1] + 1;
} else {
dp[i][j] = Math.max(dp[i - 1][j], dp[i][j - 1]);
}
}
}
return dp[sLen][tLen] === s.length;
};
```

Go:

```go
func isSubsequence(s string, t string) bool {
dp := make([][]int,len(s)+1)
Expand Down

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