Skip to content

Commit fea6e0f

Browse files
committedJan 16, 2023
Create kotlin/0392-is-subsequence.kt
1 parent 04f9b77 commit fea6e0f

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed
 

Diff for: ‎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)