-
Notifications
You must be signed in to change notification settings - Fork 185
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #893 from 0xff-dev/2486
Add solution and test-cases for problem 2486
- Loading branch information
Showing
3 changed files
with
47 additions
and
25 deletions.
There are no files selected for viewing
37 changes: 24 additions & 13 deletions
37
leetcode/2401-2500/2486.Append-Characters-to-String-to-Make-Subsequence/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 13 additions & 2 deletions
15
leetcode/2401-2500/2486.Append-Characters-to-String-to-Make-Subsequence/Solution.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,16 @@ | ||
package Solution | ||
|
||
func Solution(x bool) bool { | ||
return x | ||
func Solution(s string, t string) int { | ||
match := 0 | ||
i, j := 0, 0 | ||
for i < len(s) && j < len(t) { | ||
if s[i] == t[j] { | ||
match++ | ||
i++ | ||
j++ | ||
continue | ||
} | ||
i++ | ||
} | ||
return len(t) - match | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters