Skip to content

Commit

Permalink
Merge pull request neetcode-gh#2988 from aestheticw3/patch-1
Browse files Browse the repository at this point in the history
additional condition within the for loop
  • Loading branch information
felivalencia3 authored Sep 7, 2023
2 parents 3e1a8d3 + 9a2ac21 commit 6cc1e3f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion javascript/0392-is-subsequence.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ var isSubsequence = function(s, t) {

let j = 0;

for(let i = 0; i < t.length; i++) {
for(let i = 0; i < t.length && j < s.length; i++) {
if(s[j] === t[i]) {
j++;
}
Expand Down

0 comments on commit 6cc1e3f

Please sign in to comment.