Skip to content

Commit 1bb2995

Browse files
committed
Add 178
1 parent e30ad20 commit 1bb2995

File tree

3 files changed

+42
-2
lines changed

3 files changed

+42
-2
lines changed

.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ NB_NAME='NB'
66
SEQ_NOTATION=0
77

88
# Form Options
9-
SITE_OPTIONS=['Codewars', 'DataLemur', 'LeetCode']
9+
SITE_OPTIONS=['LeetCode']

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<!-- markdownlint-disable MD041 -->
22
[![eevveerryyddaayy release](https://img.shields.io/badge/eevveerryyddaayy-v1.3.0-blue.svg)](https://github.com/ggeerraarrdd/eevveerryyddaayy/)
3-
[![Solved](https://img.shields.io/badge/solved-177-green.svg)](#index)
3+
[![Solved](https://img.shields.io/badge/solved-178-green.svg)](#index)
44
<!-- markdownlint-enable MD041 -->
55

66
# SQL Everyday
@@ -211,6 +211,7 @@ Because this project necessitated a framework to enable consistent daily practic
211211
| 175 | [Form a Chemical Bond](https://leetcode.com/problems/form-a-chemical-bond/description/) | [Solution](solutions/175_form_a_chemical_bond.md) | LeetCode | Easy | `CROSS JOIN` |
212212
| 176 | [Concatenate the Name and the Profession](https://leetcode.com/problems/concatenate-the-name-and-the-profession/description/) | [Solution](solutions/176_concatenate_the_name_and_the_profession.md) | LeetCode | Easy | `SUBSTRING` vs `LEFT` |
213213
| 177 | [Consecutive Available Seats](https://leetcode.com/problems/consecutive-available-seats/description/) | [Solution](solutions/177_consecutive_available_seats.md) | LeetCode | Easy | |
214+
| 178 | [Shortest Distance in a Line](https://leetcode.com/problems/shortest-distance-in-a-line/description/) | [Solution](solutions/178_shortest_distance_in_a_line.md) | LeetCode | Easy | `SELF-JOIN` vs `CROSS JOIN` |
214215
<!-- Index End - WARNING: Do not delete or modify this markdown comment. -->
215216
<!--- cSpell:enable --->
216217

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# SQL Everyday \#178
2+
3+
## Shortest Distance in a Line
4+
5+
Site: LeetCode\
6+
Difficulty per Site: Easy
7+
8+
## Problem
9+
10+
Find the shortest distance between any two points from the `Point` table. [[Full Description](https://leetcode.com/problems/shortest-distance-in-a-line/description/)]
11+
12+
## Submitted Solution
13+
14+
```sql
15+
-- Submitted Solution
16+
SELECT
17+
MIN(ABS(p1.x - p2.x)) AS shortest
18+
FROM Point AS p1
19+
JOIN Point AS p2 ON p1.x != p2.x
20+
;
21+
```
22+
23+
## Site Solution
24+
25+
```sql
26+
-- LeetCode Solution
27+
-- Site solution essentially the same
28+
```
29+
30+
## Notes
31+
32+
TBD
33+
34+
## NB
35+
36+
`SELF-JOIN` vs `CROSS JOIN`
37+
38+
Go to [Index](../?tab=readme-ov-file#index)\
39+
Go to [Overview](../?tab=readme-ov-file)

0 commit comments

Comments
 (0)