We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 086ba0e commit 9a2ac21Copy full SHA for 9a2ac21
javascript/0392-is-subsequence.js
@@ -11,7 +11,7 @@ var isSubsequence = function(s, t) {
11
12
let j = 0;
13
14
- for(let i = 0; i < t.length; i++) {
+ for(let i = 0; i < t.length && j < s.length; i++) {
15
if(s[j] === t[i]) {
16
j++;
17
}
0 commit comments