0
Leetcode Problem 601. Human Traffic of Stadium
601. Human Traffic of Stadium
AI Mock Interview
Leetcode Solutions
Approach: Using Window Functions
Solution Idea
Query Steps
Code Implementation
Use a CTE to select all records with
people
>= 100.
In the CTE, use
LEAD()
and
LAG()
to get the
id
of the next two and previous two rows.
In the main query, select distinct records from the CTE where the
id
is part of a sequence of three or more consecutive
id
s.
Order the final result by
visit_date
.
erDiagram Stadium { int id date visit_date int people }
Approach: Using Self-Join
Ask Question
Programming Language
Purpose:
General Question
Debug My Code
image/screenshot of info
(optional)
[+]
Full Screen
Loading...
Get Answer
Suggested Answer
Answer
Full Screen
Copy Answer Code
Loading...