187. Repeated DNA Sequences Medium

@problem@discussion
#Hash Table#String#Bit Manipulation#Sliding Window#Rolling Hash#Hash Function



1/**
2 * [187] Repeated DNA Sequences
3 *
4 * The DNA sequence is composed of a series of nucleotides abbreviated as 'A', 'C', 'G', and 'T'.
5 * 
6 * 	For example, "ACGAATTCCG" is a DNA sequence.
7 * 
8 * When studying DNA, it is useful to identify repeated sequences within the DNA.
9 * Given a string s that represents a DNA sequence, return all the 10-letter-long sequences (substrings) that occur more than once in a DNA molecule. You may return the answer in any order.
10 *  
11 * Example 1:
12 * Input: s = "AAAAACCCCCAAAAACCCCCCAAAAAGGGTTT"
13 * Output: ["AAAAACCCCC","CCCCCAAAAA"]
14 * Example 2:
15 * Input: s = "AAAAAAAAAAAAA"
16 * Output: ["AAAAAAAAAA"]
17 *  
18 * Constraints:
19 * 
20 * 	1 <= s.length <= 10^5
21 * 	s[i] is either 'A', 'C', 'G', or 'T'.
22 * 
23 */
24pub struct Solution {}
25
26// problem: https://leetcode.com/problems/repeated-dna-sequences/
27// discuss: https://leetcode.com/problems/repeated-dna-sequences/discuss/?currentPage=1&orderBy=most_votes&query=
28
29// submission codes start here
30
31impl Solution {
32    pub fn find_repeated_dna_sequences(s: String) -> Vec<String> {
33        vec![]
34    }
35}
36
37// submission codes end
38
39#[cfg(test)]
40mod tests {
41    use super::*;
42
43    #[test]
44    fn test_187() {
45    }
46}
47


Back
© 2025 bowen.ge All Rights Reserved.