Skip to content

Commit 0e664ba

Browse files
committed
feat: add solutions to lc problem: No.1204
No.1204.Last Person to Fit in the Bus
1 parent fad185c commit 0e664ba

File tree

3 files changed

+24
-2
lines changed

3 files changed

+24
-2
lines changed

solution/1200-1299/1204.Last Person to Fit in the Bus/README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,14 @@ Thomas Jefferson(id 6) 是最后一个体重合适并进入电梯的人。</pre>
6969
<!-- 这里可写当前语言的特殊实现逻辑 -->
7070

7171
```sql
72-
72+
# Write your MySQL query statement below
73+
SELECT a.person_name
74+
FROM Queue a, Queue b
75+
WHERE a.turn >= b.turn
76+
GROUP BY a.person_id
77+
HAVING SUM(b.weight) <= 1000
78+
ORDER BY a.turn DESC
79+
LIMIT 1
7380
```
7481

7582
<!-- tabs:end -->

solution/1200-1299/1204.Last Person to Fit in the Bus/README_EN.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,14 @@ Queue table:
7272
### **SQL**
7373

7474
```sql
75-
75+
# Write your MySQL query statement below
76+
SELECT a.person_name
77+
FROM Queue a, Queue b
78+
WHERE a.turn >= b.turn
79+
GROUP BY a.person_id
80+
HAVING SUM(b.weight) <= 1000
81+
ORDER BY a.turn DESC
82+
LIMIT 1
7683
```
7784

7885
<!-- tabs:end -->
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Write your MySQL query statement below
2+
SELECT a.person_name
3+
FROM Queue a, Queue b
4+
WHERE a.turn >= b.turn
5+
GROUP BY a.person_id
6+
HAVING SUM(b.weight) <= 1000
7+
ORDER BY a.turn DESC
8+
LIMIT 1

0 commit comments

Comments
 (0)