Skip to content

Commit dcf27cf

Browse files
committed
feat: add solution to lc problem: No.0603
No.0603.Consecutive Available Seats
1 parent 2366e38 commit dcf27cf

File tree

6 files changed

+23
-30
lines changed

6 files changed

+23
-30
lines changed

solution/0600-0699/0603.Consecutive Available Seats/README.md

+6-8
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,12 @@ Cinema 表:
6262
### **SQL**
6363

6464
```sql
65-
SELECT c1.seat_id
66-
FROM Cinema c1,
67-
Cinema c2
68-
WHERE ( ( c1.seat_id = c2.seat_id + 1 )
69-
OR ( c1.seat_id = c2.seat_id - 1 ) )
70-
AND ( c1.free = 1
71-
AND c2.free = 1 )
72-
GROUP BY seat_id;
65+
# Write your MySQL query statement below
66+
SELECT DISTINCT a.seat_id
67+
FROM Cinema a
68+
JOIN Cinema b
69+
ON ABS(a.seat_id - b.seat_id) = 1 AND a.free = true AND b.free = true
70+
ORDER BY a.seat_id
7371
```
7472

7573
<!-- tabs:end -->

solution/0600-0699/0603.Consecutive Available Seats/README_EN.md

+6-8
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,12 @@ Cinema table:
5959
### **SQL**
6060

6161
```sql
62-
SELECT c1.seat_id
63-
FROM Cinema c1,
64-
Cinema c2
65-
WHERE ( ( c1.seat_id = c2.seat_id + 1 )
66-
OR ( c1.seat_id = c2.seat_id - 1 ) )
67-
AND ( c1.free = 1
68-
AND c2.free = 1 )
69-
GROUP BY seat_id;
62+
# Write your MySQL query statement below
63+
SELECT DISTINCT a.seat_id
64+
FROM Cinema a
65+
JOIN Cinema b
66+
ON ABS(a.seat_id - b.seat_id) = 1 AND a.free = true AND b.free = true
67+
ORDER BY a.seat_id
7068
```
7169

7270
<!-- tabs:end -->
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
SELECT c1.seat_id
2-
FROM Cinema c1,
3-
Cinema c2
4-
WHERE ( ( c1.seat_id = c2.seat_id + 1 )
5-
OR ( c1.seat_id = c2.seat_id - 1 ) )
6-
AND ( c1.free = 1
7-
AND c2.free = 1 )
8-
GROUP BY seat_id;
1+
# Write your MySQL query statement below
2+
SELECT DISTINCT a.seat_id
3+
FROM Cinema a
4+
JOIN Cinema b
5+
ON ABS(a.seat_id - b.seat_id) = 1 AND a.free = true AND b.free = true
6+
ORDER BY a.seat_id

solution/CONTEST_README.md

+2-3
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,14 @@
1010

1111
| 段位 | 比例 | 段位名 | 国服分数线 | 勋章 |
1212
| ---- | ---- | -------- | ----------- | ----------------------------------------------------------------------------------------------------------------------- |
13-
| LV3 | 5% | Guardian | &ge;2251.88 | <p><img alt="" src="https://fastly.jsdelivr.net/gh/doocs/leetcode@main/images/Guardian.gif" style="width: 80px;" /></p> |
14-
| LV2 | 20% | Knight | &ge;1879.80 | <p><img alt="" src="https://fastly.jsdelivr.net/gh/doocs/leetcode@main/images/Knight.gif" style="width: 80px;" /></p> |
13+
| LV3 | 5% | Guardian | &ge;2254.76 | <p><img alt="" src="https://fastly.jsdelivr.net/gh/doocs/leetcode@main/images/Guardian.gif" style="width: 80px;" /></p> |
14+
| LV2 | 20% | Knight | &ge;1882.78 | <p><img alt="" src="https://fastly.jsdelivr.net/gh/doocs/leetcode@main/images/Knight.gif" style="width: 80px;" /></p> |
1515
| LV1 | 75% | - | - | - |
1616

1717
力扣竞赛 **全国排名前 10** 的用户,全站用户名展示为品牌橙色。
1818

1919
## 赛后估分网站
2020

21-
- https://lcpredictor.herokuapp.com
2221
- https://lccn.lbao.site
2322

2423
## 往期竞赛

solution/CONTEST_README_EN.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ For top 10 users (excluding LCCN users), your LeetCode ID will be colored orange
2121

2222
## Rating Predictor
2323

24-
Get your rating changes right after the completion of LeetCode contests, https://lcpredictor.herokuapp.com
24+
Get your rating changes right after the completion of LeetCode contests, https://lccn.lbao.site
2525

2626
## Past Contests
2727

solution/template.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ Press <kbd>Control</kbd>+<kbd>F</kbd>(or <kbd>Command</kbd>+<kbd>F</kbd> on the
5454

5555
| 段位 | 比例 | 段位名 | 国服分数线 | 勋章 |
5656
| ---- | ---- | -------- | ----------- | ----------------------------------------------------------------------------------------------------------------------- |
57-
| LV3 | 5% | Guardian | &ge;2251.88 | <p><img alt="" src="https://fastly.jsdelivr.net/gh/doocs/leetcode@main/images/Guardian.gif" style="width: 80px;" /></p> |
58-
| LV2 | 20% | Knight | &ge;1879.80 | <p><img alt="" src="https://fastly.jsdelivr.net/gh/doocs/leetcode@main/images/Knight.gif" style="width: 80px;" /></p> |
57+
| LV3 | 5% | Guardian | &ge;2254.76 | <p><img alt="" src="https://fastly.jsdelivr.net/gh/doocs/leetcode@main/images/Guardian.gif" style="width: 80px;" /></p> |
58+
| LV2 | 20% | Knight | &ge;1882.78 | <p><img alt="" src="https://fastly.jsdelivr.net/gh/doocs/leetcode@main/images/Knight.gif" style="width: 80px;" /></p> |
5959
| LV1 | 75% | - | - | - |
6060

6161
力扣竞赛 **全国排名前 10** 的用户,全站用户名展示为品牌橙色。

0 commit comments

Comments
 (0)