diff --git a/go/append-characters-to-string-to-make-subsequence.go b/go/append-characters-to-string-to-make-subsequence.go new file mode 100644 index 0000000..79ad4a1 --- /dev/null +++ b/go/append-characters-to-string-to-make-subsequence.go @@ -0,0 +1,14 @@ +package append_characters_to_string_to_make_subsequence + +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 +}