Skip to content

Commit

Permalink
Merge pull request neetcode-gh#1600 from razer96/392-Is-Subsequence.go
Browse files Browse the repository at this point in the history
Create 392-Is-Subsequence.go
  • Loading branch information
dissesmac authored Dec 26, 2022
2 parents 97219d8 + 751d697 commit 82b2b0f
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions go/392-Is-Subsequence.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
func isSubsequence(s string, t string) bool {
if len(s) == 0 {
return true
}

p := 0


for i := 0; i < len(t); i++ {
if s[p] == t[i] {
p++
}

if p == len(s) {
return true
}
}

return false
}

0 comments on commit 82b2b0f

Please sign in to comment.