Nav: << previous: 186.反转字符串中的单词 II | next: 188.买卖股票的最佳时机 IV >>
Description
tab: English
<p>The <strong>DNA sequence</strong> is composed of a series of nucleotides abbreviated as <code>'A'</code>, <code>'C'</code>, <code>'G'</code>, and <code>'T'</code>.</p>
<ul>
<li>For example, <code>"ACGAATTCCG"</code> is a <strong>DNA sequence</strong>.</li>
</ul>
<p>When studying <strong>DNA</strong>, it is useful to identify repeated sequences within the DNA.</p>
<p>Given a string <code>s</code> that represents a <strong>DNA sequence</strong>, return all the <strong><code>10</code>-letter-long</strong> sequences (substrings) that occur more than once in a DNA molecule. You may return the answer in <strong>any order</strong>.</p>
<p> </p>
<p><strong class="example">Example 1:</strong></p>
<pre><strong>Input:</strong> s = "AAAAACCCCCAAAAACCCCCCAAAAAGGGTTT"
<strong>Output:</strong> ["AAAAACCCCC","CCCCCAAAAA"]
</pre><p><strong class="example">Example 2:</strong></p>
<pre><strong>Input:</strong> s = "AAAAAAAAAAAAA"
<strong>Output:</strong> ["AAAAAAAAAA"]
</pre>
<p> </p>
<p><strong>Constraints:</strong></p>
<ul>
<li><code>1 <= s.length <= 10<sup>5</sup></code></li>
<li><code>s[i]</code> is either <code>'A'</code>, <code>'C'</code>, <code>'G'</code>, or <code>'T'</code>.</li>
</ul>
---
[submissions](https://leetcode.com/problems/repeated-dna-sequences/submissions/) | [solutions](https://leetcode.com/problems/repeated-dna-sequences/solutions/)
tab: 中文
<p><strong>DNA序列</strong> 由一系列核苷酸组成,缩写为<meta charset="UTF-8" /> <code>'A'</code>, <code>'C'</code>, <code>'G'</code> 和<meta charset="UTF-8" /> <code>'T'</code>.。</p>
<ul>
<li>例如,<meta charset="UTF-8" /><code>"ACGAATTCCG"</code> 是一个 <strong>DNA序列</strong> 。</li>
</ul>
<p>在研究 <strong>DNA</strong> 时,识别 DNA 中的重复序列非常有用。</p>
<p>给定一个表示 <strong>DNA序列</strong> 的字符串 <code>s</code> ,返回所有在 DNA 分子中出现不止一次的 <strong>长度为 <code>10</code></strong> 的序列(子字符串)。你可以按 <strong>任意顺序</strong> 返回答案。</p>
<p> </p>
<p><strong>示例 1:</strong></p>
<pre>
<strong>输入:</strong>s = "AAAAACCCCCAAAAACCCCCCAAAAAGGGTTT"
<strong>输出:</strong>["AAAAACCCCC","CCCCCAAAAA"]
</pre>
<p><strong>示例 2:</strong></p>
<pre>
<strong>输入:</strong>s = "AAAAAAAAAAAAA"
<strong>输出:</strong>["AAAAAAAAAA"]
</pre>
<p> </p>
<p><strong>提示:</strong></p>
<ul>
<li><code>0 <= s.length <= 10<sup>5</sup></code></li>
<li><code>s[i]</code><code>==</code><code>'A'</code>、<code>'C'</code>、<code>'G'</code> or <code>'T'</code></li>
</ul>
---
[提交记录](https://leetcode.cn/problems/repeated-dna-sequences/submissions/) | [题解](https://leetcode.cn/problems/repeated-dna-sequences/solution/)
Solutions & Notes
properties:
note.updated:
displayName: Last Updated
note.relative_links:
displayName: Related Links
note.desc:
displayName: Description
note.grade:
displayName: Rating
note.program_language:
displayName: Language
note.time_complexity:
displayName: TC
note.space_complexity:
displayName: SC
views:
- type: table
name: Solutions & Notes
filters:
and:
- file.hasLink(this.file)
- file.tags.containsAny("leetcode/solution", "leetcode/note")
order:
- file.name
- desc
- program_language
- time_complexity
- space_complexity
- grade
- relative_links
- updated
sort:
- property: grade
direction: ASC
- property: time_complexity
direction: ASC
- property: program_language
direction: ASC
columnSize:
file.name: 104
note.space_complexity: 65
note.grade: 126
Similar Problems
properties:
note.lcTopics:
displayName: Topics
note.lcAcRate:
displayName: AC Rate
note.favorites:
displayName: Favorites
note.grade:
displayName: Rating
note.translatedTitle:
displayName: Title (CN)
note.lcDifficulty:
displayName: Difficulty
views:
- type: table
name: Similar Problems
filters:
and:
- file.hasLink(this.file)
- similarQuestions.contains(this.file)
order:
- file.name
- translatedTitle
- lcTopics
- lcDifficulty
- lcAcRate
- grade
- favorites
sort:
- property: file.name
direction: ASC
- property: lcTopics
direction: DESC
columnSize:
note.translatedTitle: 240
note.lcTopics: 347
note.lcAcRate: 75
note.grade: 122