⌘K
Flycodx

Consecutive Numbers in a Sequence

Consecutive Numbers in a Sequence

MediumSQL0% accepted

Given a Logs table with Id and Num columns, find all numbers that appear at least 3 times consecutively.

Approach

Find numbers appearing at least 3 consecutive times in a sequence.

Input

Logs: [(1,1),(2,1),(3,1),(4,2),(5,1),(6,2),(7,2)]

Output

1 (appears 3 consecutive times at rows 1,2,3)

Scenarios & Expected Answers

Sign in to continue

Create a free account to view answers and mark progress.

  • Free forever — no credit card
  • Theory Q&A with detailed answers
  • Points, streaks & leaderboards
Auto Save On