Skip to content

Commit 4db4256

Browse files
authored
feat: add solutions to lc problem: No.3476 (#4124)
No.3476.Maximize Profit from Task Assignment
1 parent 93dfaca commit 4db4256

File tree

13 files changed

+711
-56
lines changed

13 files changed

+711
-56
lines changed

solution/3400-3499/3470.Permutations IV/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ edit_url: https://github.com/doocs/leetcode/edit/main/solution/3400-3499/3470.Pe
66

77
<!-- problem:start -->
88

9-
# [3470. 排列 IV](https://leetcode.cn/problems/permutations-iv)
9+
# [3470. 全排列 IV](https://leetcode.cn/problems/permutations-iv)
1010

1111
[English Version](/solution/3400-3499/3470.Permutations%20IV/README_EN.md)
1212

solution/3400-3499/3475.DNA Pattern Recognition/README.md

+52-51
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ tags:
88

99
<!-- problem:start -->
1010

11-
# [3475. DNA Pattern Recognition](https://leetcode.cn/problems/dna-pattern-recognition)
11+
# [3475. DNA 模式识别](https://leetcode.cn/problems/dna-pattern-recognition)
1212

1313
[English Version](/solution/3400-3499/3475.DNA%20Pattern%20Recognition/README_EN.md)
1414

1515
## 题目描述
1616

1717
<!-- description:start -->
1818

19-
<p>Table: <code>Samples</code></p>
19+
<p>表:<code>Samples</code></p>
2020

2121
<pre>
2222
+----------------+---------+
@@ -26,30 +26,31 @@ tags:
2626
| dna_sequence | varchar |
2727
| species | varchar |
2828
+----------------+---------+
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)组成的字符串表示以及它所采集自的物种。
3131
</pre>
3232

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>
3434

3535
<ul>
36-
<li>Sequences that <strong>start</strong> with <strong>ATG</strong>&nbsp;(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>&nbsp;(<strong>stop codons</strong>)</li>
38-
<li>Sequences containing the motif <strong>ATAT</strong>&nbsp;(a simple repeated pattern)</li>
39-
<li>Sequences that have <strong>at least</strong> <code>3</code> <strong>consecutive</strong> <strong>G</strong>&nbsp;(like <strong>GGG</strong>&nbsp;or <strong>GGGG</strong>)</li>
36+
<li>以&nbsp;<strong>ATG</strong> <strong>开头</strong>&nbsp;的序列(一个常见的 <strong>起始密码子</strong></li>
37+
<li><strong>TAA</strong><strong>TAG</strong>&nbsp;或&nbsp;<strong>TGA</strong>&nbsp;<strong>结尾</strong>&nbsp;的序列(终止密码子)</li>
38+
<li>包含基序 <strong>ATAT</strong> 的序列(一个简单重复模式)</li>
39+
<li><strong>至少</strong>&nbsp;<code>3</code>&nbsp;<strong>个连续</strong>&nbsp;<strong>G</strong>&nbsp;的序列(如&nbsp;<strong>GGG</strong>&nbsp;或&nbsp;<strong>GGGG</strong></li>
4040
</ul>
4141

42-
<p>Return <em>the result table ordered by&nbsp;</em><em>sample_id in <strong>ascending</strong> order</em>.</p>
42+
<p>返回结果表以&nbsp;sample_id <strong>升序</strong>&nbsp;排序<em>。</em></p>
4343

44-
<p>The result format is in the following example.</p>
44+
<p>结果格式如下所示。</p>
4545

4646
<p>&nbsp;</p>
47-
<p><strong class="example">Example:</strong></p>
47+
48+
<p><strong class="example">示例:</strong></p>
4849

4950
<div class="example-block">
50-
<p><strong>Input:</strong></p>
51+
<p><strong>输入:</strong></p>
5152

52-
<p>Samples table:</p>
53+
<p>Samples 表:</p>
5354

5455
<pre class="example-io">
5556
+-----------+------------------+-----------+
@@ -65,7 +66,7 @@ Each row contains a DNA sequence represented as a string of characters (A, T, G,
6566
+-----------+------------------+-----------+
6667
</pre>
6768

68-
<p><strong>Output:</strong></p>
69+
<p><strong>输出:</strong></p>
6970

7071
<pre class="example-io">
7172
+-----------+------------------+-------------+-------------+------------+------------+------------+
@@ -81,69 +82,69 @@ Each row contains a DNA sequence represented as a string of characters (A, T, G,
8182
+-----------+------------------+-------------+-------------+------------+------------+------------+
8283
</pre>
8384

84-
<p><strong>Explanation:</strong></p>
85+
<p><strong>解释:</strong></p>
8586

8687
<ul>
87-
<li>Sample 1 (ATGCTAGCTAGCTAA):
88+
<li>样本 1(ATGCTAGCTAGCTAA):
8889
<ul>
89-
<li>Starts with ATG&nbsp;(has_start = 1)</li>
90-
<li>Ends with TAA&nbsp;(has_stop = 1)</li>
91-
<li>Does not contain ATAT&nbsp;(has_atat = 0)</li>
92-
<li>Does not contain at least 3 consecutive &#39;G&#39;s (has_ggg = 0)</li>
90+
<li>ATG 开头(has_start = 1</li>
91+
<li>TAA 结尾(has_stop = 1</li>
92+
<li>不包含 ATAThas_atat = 0</li>
93+
<li>不包含至少 3 个连续 ‘G’(has_ggg = 0</li>
9394
</ul>
9495
</li>
95-
<li>Sample 2 (GGGTCAATCATC):
96+
<li>样本 2(GGGTCAATCATC):
9697
<ul>
97-
<li>Does not start with ATG&nbsp;(has_start = 0)</li>
98-
<li>Does not end with TAA, TAG, or TGA&nbsp;(has_stop = 0)</li>
99-
<li>Does not contain ATAT&nbsp;(has_atat = 0)</li>
100-
<li>Contains GGG&nbsp;(has_ggg = 1)</li>
98+
<li>不以 ATG 开头(has_start = 0</li>
99+
<li>不以 TAATAG TGA 结尾(has_stop = 0</li>
100+
<li>不包含 ATAThas_atat = 0</li>
101+
<li>包含 GGGhas_ggg = 1</li>
101102
</ul>
102103
</li>
103-
<li>Sample 3 (ATATATCGTAGCTA):
104+
<li>样本 3(ATATATCGTAGCTA):
104105
<ul>
105-
<li>Does not start with ATG&nbsp;(has_start = 0)</li>
106-
<li>Does not end with TAA, TAG, or TGA&nbsp;(has_stop = 0)</li>
107-
<li>Contains ATAT&nbsp;(has_atat = 1)</li>
108-
<li>Does not contain at least 3 consecutive &#39;G&#39;s (has_ggg = 0)</li>
106+
<li>不以 ATG 开头(has_start = 0</li>
107+
<li>不以 TAATAG TGA 结尾(has_stop = 0</li>
108+
<li>包含 ATAThas_atat = 1</li>
109+
<li>不包含至少 3 个连续 ‘G’(has_ggg = 0</li>
109110
</ul>
110111
</li>
111-
<li>Sample 4 (ATGGGGTCATCATAA):
112+
<li>样本 4(ATGGGGTCATCATAA):
112113
<ul>
113-
<li>Starts with ATG&nbsp;(has_start = 1)</li>
114-
<li>Ends with TAA&nbsp;(has_stop = 1)</li>
115-
<li>Does not contain ATAT&nbsp;(has_atat = 0)</li>
116-
<li>Contains GGGG&nbsp;(has_ggg = 1)</li>
114+
<li>ATG 开头(has_start = 1</li>
115+
<li>TAA 结尾(has_stop = 1</li>
116+
<li>不包含 ATAThas_atat = 0</li>
117+
<li>包含 GGGGhas_ggg = 1</li>
117118
</ul>
118119
</li>
119-
<li>Sample 5 (TCAGTCAGTCAG):
120+
<li>样本 5(TCAGTCAGTCAG):
120121
<ul>
121-
<li>Does not match any patterns (all fields = 0)</li>
122+
<li>不匹配任何模式(所有字段 = 0</li>
122123
</ul>
123124
</li>
124-
<li>Sample 6 (ATATCGCGCTAG):
125+
<li>样本 6(ATATCGCGCTAG):
125126
<ul>
126-
<li>Does not start with ATG&nbsp;(has_start = 0)</li>
127-
<li>Ends with TAG&nbsp;(has_stop = 1)</li>
128-
<li>Starts with ATAT&nbsp;(has_atat = 1)</li>
129-
<li>Does not contain at least 3 consecutive &#39;G&#39;s (has_ggg = 0)</li>
127+
<li>不以 ATG 开头(has_start = 0</li>
128+
<li>TAG 结尾(has_stop = 1</li>
129+
<li>包含 ATAThas_atat = 1</li>
130+
<li>不包含至少 3 个连续 ‘G’(has_ggg = 0</li>
130131
</ul>
131132
</li>
132-
<li>Sample 7 (CGTATGCGTCGTA):
133+
<li>样本 7(CGTATGCGTCGTA):
133134
<ul>
134-
<li>Does not start with ATG&nbsp;(has_start = 0)</li>
135-
<li>Does not end with TAA, &quot;TAG&quot;, or &quot;TGA&quot; (has_stop = 0)</li>
136-
<li>Does not contain ATAT&nbsp;(has_atat = 0)</li>
137-
<li>Does not contain at least 3 consecutive &#39;G&#39;s (has_ggg = 0)</li>
135+
<li>不以 ATG 开头(has_start = 0</li>
136+
<li>不以 TAATAGTGA 结尾(has_stop = 0</li>
137+
<li>不包含 ATAThas_atat = 0</li>
138+
<li>不包含至少 3 个连续 ‘G’(has_ggg = 0</li>
138139
</ul>
139140
</li>
140141
</ul>
141142

142-
<p><strong>Note:</strong></p>
143+
<p><strong>注意:</strong></p>
143144

144145
<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>
147148
</ul>
148149
</div>
149150

0 commit comments

Comments
 (0)