1
0
Fork 0
mirror of https://gitlab.com/mfocko/LeetCode.git synced 2024-11-09 15:59:06 +01:00
LeetCode/go/append-characters-to-string-to-make-subsequence.go
Matej Focko d2ef757754
go: allow testing
Signed-off-by: Matej Focko <me@mfocko.xyz>
2024-06-16 11:44:08 +02:00

14 lines
180 B
Go

package main
func appendCharacters(s string, t string) int {
si, ti := 0, 0
for si < len(s) && ti < len(t) {
if s[si] == t[ti] {
ti++
}
si++
}
return len(t) - ti
}