Last updated
Was this helpful?
Last updated
Was this helpful?
All DNA is composed of a series of nucleotides abbreviated as A, C, G, and T, for example: "ACGAATTCCG". When studying DNA, it is sometimes useful to identify repeated sequences within the DNA.
Write a function to find all the 10-letter-long sequences (substrings) that occur more than once in a DNA molecule.
For example,
这题一开始只想出了暴力的方法,要O(n^2)的时间和空间。后来看到一种rolling hash的解法,可以O(n)搞定。(待补代码)