Skip to content

Commit

Permalink
Update: 0003-longest-substring-without-repeating-characters.js
Browse files Browse the repository at this point in the history
  • Loading branch information
benmarg committed Jan 24, 2023
1 parent 2b9810e commit 778fc8c
Showing 1 changed file with 1 addition and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,11 @@ var lengthOfLongestSubstring = function (s) {
let l = 0;
let max = 0;

for (let r = 0, sl = s.length; r < sl; r++) {
for (let r = 0; r < s.length; r++) {
while (set.has(s[r])) {
set.delete(s[l]);
l++;
}

set.add(s[r]);
max = Math.max(max, set.size);
}
Expand Down

0 comments on commit 778fc8c

Please sign in to comment.