Sunday, February 15, 2015

LeetCode [187] Repeated DNA Sequences

=====================
Note

  • method1: use unordered_map
    • 'A' - 64 = 1 (mod 5) = 1 'C' - 64 = 3 (mod 5) = 3 'G' - 64 = 7 (mod 5) = 2 'T' - 64 = 20 (mod 5) = 0
    • OJ does have test cases in which the given string is less than 9
  • method2: use an array

Ref
[1] https://oj.leetcode.com/problems/repeated-dna-sequences/
OJ
[2] https://oj.leetcode.com/discuss/24478/i-did-it-in-10-lines-of-c
method1 

No comments:

Post a Comment