Skip to main content
Admissions guidance, study banks, and career tools โ€” get started on Shalyam

Consecutive Numbers

Find all numbers that appear at least three times consecutively in the Logs table (consecutive by id). Return them in a column named ConsecutiveNums.

Table schema

Logs(id INT PRIMARY KEY, num INT)

Sample data

id | num
1 | 1
2 | 1
3 | 1
4 | 2
5 | 1
6 | 2
7 | 2

Discussion

No discussions yet.

Rewards ยท v2.1

Join Shalyam Newsletter

Get exclusive insights with every issue: education, research and innovation news.

One email a week. Unsubscribe any time.