SQL: Consecutive Numbers
Medium
SQL — Self Join
SQL
Self Join
Consecutive
Find numbers appearing 3+ consecutive times.
Constraints
Write standard SQL (MySQL 8.0 compatible).
Examples
Example 1:
Input: num
1
1
1
2
1
Output:
Example 2:
Input: num
1
1
1
2
1
Output:
Hints
Self-join on consecutive rows.
Tests:
Runtime:
Memory:
Test
Input:
Expected:
Got:
Click Run Code to test against sample cases, or Submit to test against all cases.
▲ Console