We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 38c4460 commit 1ad4e09Copy full SHA for 1ad4e09
findlongest
@@ -43,9 +43,11 @@ private static void updateHashtable(int current){
43
increment = 1 + (hash.containsKey(left) && left!=current ? hash.get(left) : 0);
44
else
45
increment = 1 + (hash.containsKey(left) && left!=current ? hash.get(left) : 0) + (hash.containsKey(right) && right!=current? hash.get(right) : 0);
46
+
47
if (hash.containsKey(left)) hash.put(left, increment); // update leftmost
48
if (hash.containsKey(right)) hash.put(right, increment); // update rightmost
49
hash.put(current, increment); // update current
50
51
max_length = Math.max(max_length, increment);
52
53
}
0 commit comments