SQL: Human Traffic of Stadium
Medium
SQL — Advanced
SQL
Self Join
Consecutive
Find 3+ consecutive rows with >= 100 visitors.
Constraints
Write standard SQL (MySQL 8.0 compatible).
Examples
Example 1:
Input: id visitors
1 120
2 130
3 90
4 110
5 150
6 200
Output:
Example 2:
Input: id visitors
1 120
2 130
3 90
4 110
5 150
6 200
Output:
Hints
Self-join on consecutive IDs.
Tests:
Runtime:
Memory:
Test
Input:
Expected:
Got:
Click Run Code to test against sample cases, or Submit to test against all cases.
▲ Console