top of page

Leetcode 180. Consecutive Numbers

  • crystal0108wong
  • Jun 1, 2017
  • 1 min read

Description

Write a SQL query to find all numbers that appear at least three times consecutively. [Read Full Description Here]

Solution

Thought Process

1. Perform a three-way self-join on the table while joining on the the row on id with row on (id + 1) while at the same time ensuring the values in number column are the same.

Comments


Featured Posts
Tag Cloud
Category

Crystal Wang @ 2017

bottom of page