File tree 1 file changed +2
-2
lines changed
src/main/java/com/fishercoder/solutions
1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ public List<String> findRepeatedDnaSequences(String s) {
28
28
public static class Solution2 {
29
29
/**
30
30
* Use Rolling Hash/Rabin-Karp algorithm to significantly speed up the search.
31
- *
31
+ * <p>
32
32
* Rolling Hash/Rabin-Karp algorithm:
33
33
* Instead of comparing the entire string to the other, we compare only the hash after adding the incoming character
34
34
* and removing the outgoing character, this could be done in constant time.
@@ -40,7 +40,7 @@ public static class Solution2 {
40
40
* so for a DNA sequence that is 10 character long, a total of 10 * 2 = 20 bits is good enough, this is much smaller than
41
41
* an Integer (32-bit) in most modern programming languages, so using one integer could well represent one DNA sequence.
42
42
* Thus we could do bit manipulation to implement the removal of the outgoing character and the addition of the incoming character.
43
- *
43
+ * <p>
44
44
* <<= 2 will shift the integer to the left, i.e. removing the outgoing character;
45
45
* |= val will add the incoming character.
46
46
*/
You can’t perform that action at this time.
0 commit comments