Skip to content

Commit 751d697

Browse files
committed
Create 392-Is-Subsequence.go
1 parent 85918f7 commit 751d697

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

Diff for: go/392-Is-Subsequence.go

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
func isSubsequence(s string, t string) bool {
2+
if len(s) == 0 {
3+
return true
4+
}
5+
6+
p := 0
7+
8+
9+
for i := 0; i < len(t); i++ {
10+
if s[p] == t[i] {
11+
p++
12+
}
13+
14+
if p == len(s) {
15+
return true
16+
}
17+
}
18+
19+
return false
20+
}

0 commit comments

Comments
 (0)