Skip to content

Commit 1f0cf34

Browse files
author
chenweijie
committed
array
1 parent 1412efa commit 1f0cf34

File tree

2 files changed

+2
-13
lines changed

2 files changed

+2
-13
lines changed

src/main/java/com/chen/Test.java

Lines changed: 0 additions & 11 deletions
This file was deleted.

src/main/java/com/chen/algorithm/study/test3/Solution4.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ public int lengthOfLongestSubstring(String s) {
2727
char c = s.charAt(i);
2828

2929
if (map.containsKey(c)) {
30-
left = Math.max(left, map.get(c));
30+
left = Math.max(left, map.get(c) + 1);
3131
}
32-
max = Math.max(max, i - left);
32+
max = Math.max(max, i - left + 1);
3333
map.put(c, i);
3434
}
3535
return max;

0 commit comments

Comments
 (0)