Skip to content

Commit

Permalink
Create kotlin/0392-is-subsequence.kt
Browse files Browse the repository at this point in the history
  • Loading branch information
a93a committed Jan 16, 2023
1 parent 04f9b77 commit fea6e0f
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 fea6e0f

Please sign in to comment.