[문제]
[MySQL]
WITH Total_weight AS (
SELECT *
, SUM(weight) OVER (ORDER BY turn ASC ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS cumsum
FROM Queue
)
SELECT person_name
FROM Total_weight
WHERE CUMSUM <= 1000
ORDER BY cumsum DESC
LIMIT 1
'SQL > LeetCode' 카테고리의 다른 글
| [LeetCode] 1251. Average Selling Price (0) | 2025.02.20 |
|---|---|
| [LeetCode] 1211. Queries Quality and Percentage (0) | 2025.02.19 |
| [LeetCode] 1193. Monthly Transactions I (0) | 2025.02.19 |
| [LeetCode] 1179. Reformat Department Table (0) | 2025.02.19 |
| [LeetCode] 1174. Immediate Food Delivery II (0) | 2025.02.19 |
