Skip to content

Commit 3d6630f

Browse files
update 187
1 parent fdc2abe commit 3d6630f

File tree

1 file changed

+2
-2
lines changed
  • src/main/java/com/fishercoder/solutions

1 file changed

+2
-2
lines changed

Diff for: src/main/java/com/fishercoder/solutions/_187.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public List<String> findRepeatedDnaSequences(String s) {
2828
public static class Solution2 {
2929
/**
3030
* Use Rolling Hash/Rabin-Karp algorithm to significantly speed up the search.
31-
*
31+
* <p>
3232
* Rolling Hash/Rabin-Karp algorithm:
3333
* Instead of comparing the entire string to the other, we compare only the hash after adding the incoming character
3434
* and removing the outgoing character, this could be done in constant time.
@@ -40,7 +40,7 @@ public static class Solution2 {
4040
* 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
4141
* an Integer (32-bit) in most modern programming languages, so using one integer could well represent one DNA sequence.
4242
* Thus we could do bit manipulation to implement the removal of the outgoing character and the addition of the incoming character.
43-
*
43+
* <p>
4444
* <<= 2 will shift the integer to the left, i.e. removing the outgoing character;
4545
* |= val will add the incoming character.
4646
*/

0 commit comments

Comments
 (0)