Skip to content

Commit c88c468

Browse files
committed
Upload 163
1 parent b1f0548 commit c88c468

File tree

3 files changed

+71
-25
lines changed

3 files changed

+71
-25
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
<!-- markdownlint-disable MD041 -->
2+
[![eevveerryyddaayy release](https://img.shields.io/badge/eevveerryyddaayy-v1.3.0-blue.svg)](#index)
3+
[![Solved](https://img.shields.io/badge/solved-163-green.svg)](#index)
4+
<!-- markdownlint-enable MD041 -->
5+
16
# SQL Everyday
27

38
One SQL problem a day for a year
@@ -191,6 +196,7 @@ Because this project necessitated a framework to enable consistent daily practic
191196
| 160 | [Employees With Missing Information](https://leetcode.com/problems/employees-with-missing-information/description/) | [Solution](solutions/160_employees_with_missing_information.md) | LeetCode | Easy | `FULL JOIN` |
192197
| 161 | [Delete Duplicate Emails](https://leetcode.com/problems/delete-duplicate-emails/description/) | [Solution](solutions/161_delete_duplicate_emails.md) | LeetCode | Easy | |
193198
| 162 | [Find Products with Valid Serial Numbers](https://leetcode.com/problems/find-products-with-valid-serial-numbers/description/) | [Solution](solutions/162_find_products_with_valid_serial_numbers.md) | LeetCode | Easy | Regex |
199+
| 163 | [DNA Pattern Recognition](https://leetcode.com/problems/dna-pattern-recognition/description/) | [Solution](solutions/163_dna_pattern_recognition_.md) | LeetCode | Easy | |
194200
<!-- Index End - WARNING: Do not delete or modify this markdown comment. -->
195201
<!--- cSpell:enable --->
196202

eevveerryyddaayy.ipynb

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,9 @@
22
"cells": [
33
{
44
"cell_type": "code",
5-
"execution_count": 1,
5+
"execution_count": null,
66
"metadata": {},
7-
"outputs": [
8-
{
9-
"data": {
10-
"application/vnd.jupyter.widget-view+json": {
11-
"model_id": "2673fef8a1144aaaa7bd7a5961ae2f62",
12-
"version_major": 2,
13-
"version_minor": 0
14-
},
15-
"text/plain": [
16-
"VBox(children=(VBox(children=(HTML(value='<span style=\"font-size:20px;\"><b>EEVVEERRYYDDAAYY</b></span>', layou…"
17-
]
18-
},
19-
"metadata": {},
20-
"output_type": "display_data"
21-
},
22-
{
23-
"name": "stdout",
24-
"output_type": "stream",
25-
"text": [
26-
"Processing...\n",
27-
"Done\n"
28-
]
29-
}
30-
],
7+
"outputs": [],
318
"source": [
329
"\"\"\"\n",
3310
"Run this cell to display the form interface.\n",
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# SQL Everyday \#163
2+
3+
## DNA Pattern Recognition
4+
5+
Site: LeetCode\
6+
Difficulty per Site: Easy
7+
8+
## Problem
9+
10+
Biologists are studying basic patterns in DNA sequences. Write a solution to identify `sample_id` with the following patterns:
11+
12+
* Sequences that start with ATG (a common start codon)
13+
* Sequences that end with either TAA, TAG, or TGA (stop codons)
14+
* Sequences containing the motif ATAT (a simple repeated pattern)
15+
* Sequences that have at least 3 consecutive G (like GGG or GGGG)
16+
17+
Return the result table ordered by sample_id in ascending order. [[Full Description](https://leetcode.com/problems/dna-pattern-recognition/description/)]
18+
19+
## Submitted Solution
20+
21+
```sql
22+
-- Submitted Solution
23+
-- PostgreSQL
24+
SELECT
25+
sample_id
26+
,dna_sequence
27+
,species
28+
,CASE WHEN dna_sequence LIKE 'ATG%'
29+
THEN 1 ELSE 0 END AS has_start
30+
,CASE WHEN dna_sequence LIKE '%TAA'
31+
OR dna_sequence LIKE '%TAG'
32+
OR dna_sequence LIKE '%TGA'
33+
THEN 1 ELSE 0 END AS has_stop
34+
,CASE WHEN dna_sequence LIKE 'ATAT%'
35+
OR dna_sequence LIKE '%ATAT%'
36+
OR dna_sequence LIKE '%ATAT'
37+
THEN 1 ELSE 0 END AS has_atat
38+
,CASE WHEN dna_sequence LIKE 'GGG%'
39+
OR dna_sequence LIKE '%GGG%'
40+
OR dna_sequence LIKE '%GGG'
41+
THEN 1 ELSE 0 END AS has_ggg
42+
FROM Samples
43+
ORDER BY sample_id ASC
44+
;
45+
```
46+
47+
## Site Solution
48+
49+
```sql
50+
-- LeetCode Solution
51+
TBD
52+
```
53+
54+
## Notes
55+
56+
TBD
57+
58+
## NB
59+
60+
TBD
61+
62+
Go to [Index](../?tab=readme-ov-file#index)\
63+
Go to [Overview](../?tab=readme-ov-file)

0 commit comments

Comments
 (0)