Skip to content

Commit ff5a166

Browse files
committed
solved: 392
1 parent aec9d59 commit ff5a166

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

code/392.is-subsequence.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// @leet start
2+
function isSubsequence(s: string, t: string): boolean {
3+
let count = 0;
4+
5+
for (const char of t) {
6+
if (char === s[count]) {
7+
count++;
8+
}
9+
}
10+
11+
return count === s.length;
12+
}
13+
// @leet end
14+

0 commit comments

Comments
 (0)