Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit e2e6369

Browse files
committed
solve problem Consecutive Numbers
1 parent 07a4821 commit e2e6369

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

‎README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,4 +333,5 @@ All solutions will be accepted!
333333
|181|[Employees Earning More Than Their Managers](https://leetcode-cn.com/problems/employees-earning-more-than-their-managers/description/)|[mysql](./database/EmployeesEarningMoreThanTheirManagers)|Easy|
334334
|176|[Second Highest Salary](https://leetcode-cn.com/problems/second-highest-salary/description/)|[mysql](./database/SecondHighestSalary)|Easy|
335335
|626|[Exchange Seats](https://leetcode-cn.com/problems/exchange-seats/description/)|[mysql](./database/ExchangeSeats)|Medium|
336-
|178|[Rank Scores](https://leetcode-cn.com/problems/rank-scores/description/)|[mysql](./database/RankScore)|Medium|
336+
|178|[Rank Scores](https://leetcode-cn.com/problems/rank-scores/description/)|[mysql](./database/RankScore)|Medium|
337+
|180|[Consecutive Numbers](https://leetcode-cn.com/problems/consecutive-numbers/description/)|[mysql](./database/ConsecutiveNumbers)|Medium|

‎database/ConsecutiveNumbers/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Consecutive Numbers
2+
We can solve this problem by twice join
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Write your MySQL query statement below
2+
select distinct l.Num as ConsecutiveNums from Logs as l
3+
join Logs as r
4+
on l.Id + 1 = r.Id and l.Num = r.Num
5+
join Logs as r2
6+
on r.Id + 1 = r2.Id and r.Num = r2.Num

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /