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.
▲ Console

Install Talent Arabia

Get instant access to jobs and career tools on your device.