This answer didn't use the id column though..
'''select distinct num ConsecutiveNums from (
when @prev<>@prev:=num then @n:=1
end n, num
from Logs, (select @n:=1, @prev:=-1) init) mytable
where n >=3'''
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.