Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 991bc56

Browse filesBrowse files
committed
Update README.md
1 parent cc91e5d commit 991bc56
Copy full SHA for 991bc56

File tree

1 file changed

+17
-0
lines changed
Filter options

1 file changed

+17
-0
lines changed

‎README.md

Copy file name to clipboardExpand all lines: README.md
+17Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -515,4 +515,21 @@ FROM Accounts
515515
UNION
516516
SELECT 'High Salary' AS category, SUM(IF(income>50000,1,0)) AS accounts_count
517517
FROM Accounts
518+
```
519+
520+
[1204. Last Person to Fit in the Bus](https://leetcode.com/problems/last-person-to-fit-in-the-bus/)
521+
```sql
522+
-- 1000 kg limit
523+
-- name of last person
524+
525+
WITH CTE AS (
526+
SELECT person_name, weight, turn, SUM(weight)
527+
OVER(ORDER BY turn) AS total_weight
528+
FROM Queue
529+
)
530+
SELECT person_name
531+
FROM cte
532+
WHERE total_weight <=1000
533+
ORDER BY total_weight DESC
534+
LIMIT 1;
518535
```

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.