LeetCode Medium 1204 Wayfair Interview SQL Question with Detailed Explanation

preview_player
Показать описание

In this video I solve and explain a medium difficulty leetcode SQL question using MySQL query. This question has been asked in Apple, Facebook, Amazon, Google, Adobe, Microsoft, Adobe interviews or what we popularly call FAANG interviews.
I explain the related concept as well. This question includes points to keep in mind to develop SQL queries.

LeetCode is the best platform to help you enhance your skills, expand your knowledge and prepare for technical interviews.

If you found this helpful, Like and Subscribe to the channel for more content.

#LeetCodeSQL #FAANG #SQLinterviewQuestions
Рекомендации по теме
Комментарии
Автор

with cte as
(
select person_id, person_name, turn, sum(weight) over (order by turn asc ) as ttl_wt
from Queue
order by turn asc )

select person_name from Queue
where turn = (select max(turn) from cte where ttl_wt <=1000 )

expandingourselves
Автор

there is no requirement to write rows between unbounded preceding
instead sum(weight) over(order by turn) is enough

GoodUser
Автор

with cte1 as(
select person_name, sum(weight) over(order by turn) as cumweight from Queue)
select last_value(person_name) over() as person_name from cte1 where cumweight<=1000 order by cumweight limit 1;

mickyman
Автор

Hey, there is no need of between unbounded preceding and current row, also I have not find it any where which is used by (select person_name from (select person_name, weight, sum(weight) over (order by turn) as cul_sum
from queue)x
where cul_sum <= 1000
order by cul_sum desc
limit 1)
simple answer

AmanRaj-ufwx
join shbcf.ru