Skip to content

Commit

Permalink
Merge pull request neetcode-gh#2049 from a93a/392
Browse files Browse the repository at this point in the history
Create kotlin/0392-is-subsequence.kt
  • Loading branch information
a93a authored Jan 16, 2023
2 parents 04f9b77 + fea6e0f commit 05c62da
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions kotlin/0392-is-subsequence.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
class Solution {
fun isSubsequence(s: String, t: String): Boolean {
var sIndex = 0
var tIndex = 0
while(sIndex < s.length && tIndex < t.length){
if(s[sIndex] == t[tIndex]) sIndex++
tIndex++
}
return sIndex == s.length
}
}

0 comments on commit 05c62da

Please sign in to comment.