Skip to content

Commit 05c62da

Browse files
authored
Merge pull request #2049 from a93a/392
Create kotlin/0392-is-subsequence.kt
2 parents 04f9b77 + fea6e0f commit 05c62da

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

kotlin/0392-is-subsequence.kt

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
class Solution {
2+
fun isSubsequence(s: String, t: String): Boolean {
3+
var sIndex = 0
4+
var tIndex = 0
5+
while(sIndex < s.length && tIndex < t.length){
6+
if(s[sIndex] == t[tIndex]) sIndex++
7+
tIndex++
8+
}
9+
return sIndex == s.length
10+
}
11+
}

0 commit comments

Comments
 (0)