8
8
9
9
<!-- problem:start -->
10
10
11
- # [ 3475. DNA Pattern Recognition ] ( https://leetcode.cn/problems/dna-pattern-recognition )
11
+ # [ 3475. DNA 模式识别 ] ( https://leetcode.cn/problems/dna-pattern-recognition )
12
12
13
13
[ English Version] ( /solution/3400-3499/3475.DNA%20Pattern%20Recognition/README_EN.md )
14
14
15
15
## 题目描述
16
16
17
17
<!-- description:start -->
18
18
19
- <p >Table: <code >Samples</code ></p >
19
+ <p >表: <code >Samples</code ></p >
20
20
21
21
<pre >
22
22
+----------------+---------+
@@ -26,30 +26,31 @@ tags:
26
26
| dna_sequence | varchar |
27
27
| species | varchar |
28
28
+----------------+---------+
29
- sample_id is the unique key for this table.
30
- Each row contains a DNA sequence represented as a string of characters (A, T, G, C) and the species it was collected from.
29
+ sample_id 是这张表的唯一主键。
30
+ 每一行包含一个 DNA 序列以一个字符(A,T,G,C)组成的字符串表示以及它所采集自的物种。
31
31
</pre >
32
32
33
- <p >Biologists are studying basic patterns in DNA sequences. Write a solution to identify <code >sample_id</code > with the following patterns: </p >
33
+ <p >生物学家正在研究 DNA 序列中的基本模式。编写一个解决方案以识别具有以下模式的 & nbsp ; <code >sample_id</code >: </p >
34
34
35
35
<ul >
36
- <li>Sequences that <strong>start </strong> with <strong>ATG </strong> (a common <strong>start codon </strong>) </li>
37
- <li>Sequences that <strong>end</strong> with either <strong> TAA</strong>, <strong>TAG</strong>, or <strong>TGA</strong> ( <strong>stop codons </strong>) </li>
38
- <li>Sequences containing the motif <strong>ATAT</strong> (a simple repeated pattern) </li>
39
- <li>Sequences that have <strong>at least </strong> <code>3</code> <strong>consecutive </strong> <strong>G</strong> (like <strong>GGG</strong> or <strong>GGGG</strong>) </li>
36
+ <li>以 <strong>ATG </strong> <strong>开头 </strong> 的序列(一个常见的 <strong>起始密码子 </strong>) </li>
37
+ <li>以 <strong>TAA</strong>, <strong>TAG</strong> 或 <strong>TGA</strong> <strong>结尾 </strong> 的序列(终止密码子) </li>
38
+ <li>包含基序 <strong>ATAT</strong> 的序列(一个简单重复模式) </li>
39
+ <li>有 <strong>至少 </strong> <code>3</code> <strong>个连续 </strong> <strong>G</strong> 的序列(如 <strong>GGG</strong> 或 <strong>GGGG</strong>) </li>
40
40
</ul >
41
41
42
- <p >Return < em >the result table ordered by   ; </ em >< em > sample_id in <strong >ascending </strong > order< /em >. </p >
42
+ <p >返回结果表以   ; sample_id <strong >升序 </strong >& nbsp ; 排序< em >。< /em ></p >
43
43
44
- <p >The result format is in the following example. </p >
44
+ <p >结果格式如下所示。 </p >
45
45
46
46
<p >  ; </p >
47
- <p ><strong class =" example " >Example:</strong ></p >
47
+
48
+ <p ><strong class =" example " >示例:</strong ></p >
48
49
49
50
<div class =" example-block " >
50
- <p ><strong >Input: </strong ></p >
51
+ <p ><strong >输入: </strong ></p >
51
52
52
- <p >Samples table: </p >
53
+ <p >Samples 表: </p >
53
54
54
55
<pre class =" example-io " >
55
56
+-----------+------------------+-----------+
@@ -65,7 +66,7 @@ Each row contains a DNA sequence represented as a string of characters (A, T, G,
65
66
+-----------+------------------+-----------+
66
67
</pre >
67
68
68
- <p ><strong >Output: </strong ></p >
69
+ <p ><strong >输出: </strong ></p >
69
70
70
71
<pre class =" example-io " >
71
72
+-----------+------------------+-------------+-------------+------------+------------+------------+
@@ -81,69 +82,69 @@ Each row contains a DNA sequence represented as a string of characters (A, T, G,
81
82
+-----------+------------------+-------------+-------------+------------+------------+------------+
82
83
</pre >
83
84
84
- <p ><strong >Explanation: </strong ></p >
85
+ <p ><strong >解释: </strong ></p >
85
86
86
87
<ul >
87
- <li>Sample 1 ( ATGCTAGCTAGCTAA):
88
+ <li>样本 1( ATGCTAGCTAGCTAA):
88
89
<ul>
89
- <li>Starts with ATG ( has_start = 1) </li>
90
- <li>Ends with TAA ( has_stop = 1) </li>
91
- <li>Does not contain ATAT ( has_atat = 0) </li>
92
- <li>Does not contain at least 3 consecutive 'G's ( has_ggg = 0) </li>
90
+ <li>以 ATG 开头( has_start = 1) </li>
91
+ <li>以 TAA 结尾( has_stop = 1) </li>
92
+ <li>不包含 ATAT( has_atat = 0) </li>
93
+ <li>不包含至少 3 个连续 ‘G’( has_ggg = 0) </li>
93
94
</ul>
94
95
</li>
95
- <li>Sample 2 ( GGGTCAATCATC):
96
+ <li>样本 2( GGGTCAATCATC):
96
97
<ul>
97
- <li>Does not start with ATG ( has_start = 0) </li>
98
- <li>Does not end with TAA, TAG, or TGA ( has_stop = 0) </li>
99
- <li>Does not contain ATAT ( has_atat = 0) </li>
100
- <li>Contains GGG ( has_ggg = 1) </li>
98
+ <li>不以 ATG 开头( has_start = 0) </li>
99
+ <li>不以 TAA, TAG 或 TGA 结尾( has_stop = 0) </li>
100
+ <li>不包含 ATAT( has_atat = 0) </li>
101
+ <li>包含 GGG( has_ggg = 1) </li>
101
102
</ul>
102
103
</li>
103
- <li>Sample 3 ( ATATATCGTAGCTA):
104
+ <li>样本 3( ATATATCGTAGCTA):
104
105
<ul>
105
- <li>Does not start with ATG ( has_start = 0) </li>
106
- <li>Does not end with TAA, TAG, or TGA ( has_stop = 0) </li>
107
- <li>Contains ATAT ( has_atat = 1) </li>
108
- <li>Does not contain at least 3 consecutive 'G's ( has_ggg = 0) </li>
106
+ <li>不以 ATG 开头( has_start = 0) </li>
107
+ <li>不以 TAA, TAG 或 TGA 结尾( has_stop = 0) </li>
108
+ <li>包含 ATAT( has_atat = 1) </li>
109
+ <li>不包含至少 3 个连续 ‘G’( has_ggg = 0) </li>
109
110
</ul>
110
111
</li>
111
- <li>Sample 4 ( ATGGGGTCATCATAA):
112
+ <li>样本 4( ATGGGGTCATCATAA):
112
113
<ul>
113
- <li>Starts with ATG ( has_start = 1) </li>
114
- <li>Ends with TAA ( has_stop = 1) </li>
115
- <li>Does not contain ATAT ( has_atat = 0) </li>
116
- <li>Contains GGGG ( has_ggg = 1) </li>
114
+ <li>以 ATG 开头( has_start = 1) </li>
115
+ <li>以 TAA 结尾( has_stop = 1) </li>
116
+ <li>不包含 ATAT( has_atat = 0) </li>
117
+ <li>包含 GGGG( has_ggg = 1) </li>
117
118
</ul>
118
119
</li>
119
- <li>Sample 5 ( TCAGTCAGTCAG):
120
+ <li>样本 5( TCAGTCAGTCAG):
120
121
<ul>
121
- <li>Does not match any patterns (all fields = 0) </li>
122
+ <li>不匹配任何模式(所有字段 = 0) </li>
122
123
</ul>
123
124
</li>
124
- <li>Sample 6 ( ATATCGCGCTAG):
125
+ <li>样本 6( ATATCGCGCTAG):
125
126
<ul>
126
- <li>Does not start with ATG ( has_start = 0) </li>
127
- <li>Ends with TAG ( has_stop = 1) </li>
128
- <li>Starts with ATAT ( has_atat = 1) </li>
129
- <li>Does not contain at least 3 consecutive 'G's ( has_ggg = 0) </li>
127
+ <li>不以 ATG 开头( has_start = 0) </li>
128
+ <li>以 TAG 结尾( has_stop = 1) </li>
129
+ <li>包含 ATAT( has_atat = 1) </li>
130
+ <li>不包含至少 3 个连续 ‘G’( has_ggg = 0) </li>
130
131
</ul>
131
132
</li>
132
- <li>Sample 7 ( CGTATGCGTCGTA):
133
+ <li>样本 7( CGTATGCGTCGTA):
133
134
<ul>
134
- <li>Does not start with ATG ( has_start = 0) </li>
135
- <li>Does not end with TAA, " TAG", or " TGA" ( has_stop = 0) </li>
136
- <li>Does not contain ATAT ( has_atat = 0) </li>
137
- <li>Does not contain at least 3 consecutive 'G's ( has_ggg = 0) </li>
135
+ <li>不以 ATG 开头( has_start = 0) </li>
136
+ <li>不以 TAA, TAG 或 TGA 结尾( has_stop = 0) </li>
137
+ <li>不包含 ATAT( has_atat = 0) </li>
138
+ <li>不包含至少 3 个连续 ‘G’( has_ggg = 0) </li>
138
139
</ul>
139
140
</li>
140
141
</ul >
141
142
142
- <p ><strong >Note: </strong ></p >
143
+ <p ><strong >注意: </strong ></p >
143
144
144
145
<ul >
145
- <li>The result is ordered by sample_id in ascending order </li>
146
- <li>For each pattern, 1 indicates the pattern is present and 0 indicates it is not present </li>
146
+ <li>结果以 sample_id 升序排序 </li>
147
+ <li>对于每个模式,1 表示该模式存在,0 表示不存在 </li>
147
148
</ul >
148
149
</div >
149
150
0 commit comments