LeetCode 180: Consecutive Numbers
Problem Description
Explanation
To solve this problem, we can use a SQL query that leverages window functions to find consecutive numbers that appear at least three times. We can use the LAG
and LEAD
functions to compare the current row with the previous and next rows, respectively. If the current row's num
value is equal to both the previous and next rows' num
values, then we have a sequence of at least three consecutive numbers.
SQL
Solutions
/* Not applicable for SQL problems */
Related LeetCode Problems
Loading editor...