Skip to content

Commit 86d068c

Browse files
authored
Merge pull request #1390 from loczek/392-Is-Subsequence
Create: 392-Is-Subsequence.ts
2 parents 3fb4e19 + f0b81d6 commit 86d068c

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

typescript/392-Is-Subsequence.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
function isSubsequence(s: string, t: string): boolean {
2+
let i = 0;
3+
let j = 0;
4+
5+
while (i < s.length && j < t.length) {
6+
if (s[i] === t[j]) {
7+
i += 1;
8+
}
9+
j += 1;
10+
}
11+
12+
return i === s.length;
13+
}

0 commit comments

Comments
 (0)