mirror of
https://gitlab.com/mfocko/LeetCode.git
synced 2024-11-09 15:59:06 +01:00
18 lines
211 B
Go
18 lines
211 B
Go
package main
|
|
|
|
func isSubsequence(s string, t string) bool {
|
|
length := len(s)
|
|
|
|
i := 0
|
|
for j := range t {
|
|
if i < length && t[j] == s[i] {
|
|
i++
|
|
}
|
|
|
|
if i >= length {
|
|
break
|
|
}
|
|
}
|
|
|
|
return i == length
|
|
}
|