From table `Logs(id, num)`, find all numbers that appear at least three times consecutively (by id order).
Examples
Input
nums 1,1,1,2,2,2,2 at consecutive ids
Output
1 and 2
Constraints
- Self-join or window functions
- Return distinct num
From table `Logs(id, num)`, find all numbers that appear at least three times consecutively (by id order).
nums 1,1,1,2,2,2,2 at consecutive ids
1 and 2
Explore step-by-step interactive animations, memory state tracking, and live multi-language execution in DrawCode.
Launch Interactive Visualizer