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 #324

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 11 commits into AlgorithmAndLeetCode:master from youngyangyang04:master
Aug 3, 2023
Merged
Changes from 1 commit
Commits
Show all changes
11 commits
Select commit Hold shift + click to select a range
9807ea6
Update 1143.最长公共子序列.md about rust
fwqaaq Jul 18, 2023
695f867
Update 1035.不相交的线.md about rust
fwqaaq Jul 18, 2023
1a2c911
添加 1207 独一无二的出现次数 Go 版本
wangben18 Jul 19, 2023
eb9c4e6
Update 0392.判断子序列.md about rust
fwqaaq Jul 23, 2023
503c83d
Update 0392.判断子序列.md
fwqaaq Jul 23, 2023
2f815bc
Merge branch 'master' into patch-48
fwqaaq Jul 30, 2023
5a80e1d
Merge pull request #2189 from fwqaaq/patch-48
youngyangyang04 Aug 3, 2023
197d6c5
Merge pull request #2190 from fwqaaq/patch-49
youngyangyang04 Aug 3, 2023
f08eaaa
Merge branch 'master' into master
youngyangyang04 Aug 3, 2023
13888a5
Merge pull request #2192 from wangben18/master
youngyangyang04 Aug 3, 2023
e23099f
Merge pull request #2197 from fwqaaq/patch-50
youngyangyang04 Aug 3, 2023
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
Update 0392.判断子序列.md
  • Loading branch information
fwqaaq authored Jul 23, 2023
commit 503c83db8e9323fe4a94bd824a2b19ff617780d2
24 changes: 24 additions & 0 deletions problems/0392.判断子序列.md
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,30 @@ impl Solution {
}
```

> 滚动数组

```rust
impl Solution {
pub fn is_subsequence(s: String, t: String) -> bool {
let mut dp = vec![0; t.len() + 1];
let (s, t) = (s.as_bytes(), t.as_bytes());
for &byte_s in s {
let mut pre = 0;
for j in 0..t.len() {
let temp = dp[j + 1];
if byte_s == t[j] {
dp[j + 1] = pre + 1;
} else {
dp[j + 1] = dp[j];
}
pre = temp;
}
}
dp[t.len()] == s.len()
}
}
```

<p align="center">
<a href="https://programmercarl.com/other/kstar.html" target="_blank">
<img src="../pics/网站星球宣传海报.jpg" width="1000"/>
Expand Down

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