Skip to content

Commit 1ad4e09

Browse files
committed
Update findlongest
1 parent 38c4460 commit 1ad4e09

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

findlongest

+2
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,11 @@ private static void updateHashtable(int current){
4343
increment = 1 + (hash.containsKey(left) && left!=current ? hash.get(left) : 0);
4444
else
4545
increment = 1 + (hash.containsKey(left) && left!=current ? hash.get(left) : 0) + (hash.containsKey(right) && right!=current? hash.get(right) : 0);
46+
4647
if (hash.containsKey(left)) hash.put(left, increment); // update leftmost
4748
if (hash.containsKey(right)) hash.put(right, increment); // update rightmost
4849
hash.put(current, increment); // update current
50+
4951
max_length = Math.max(max_length, increment);
5052

5153
}

0 commit comments

Comments
 (0)