Skip to content

Commit 5ea4f0a

Browse files
committed
Time: 101 ms (31.52%), Space: 42.3 MB (38.71%) - LeetHub
1 parent 44ef3b7 commit 5ea4f0a

File tree

1 file changed

+17
-0
lines changed

1 file changed

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

0 commit comments

Comments
 (0)