Skip to content

Commit

Permalink
Time: 1264 ms (5.01%), Space: 0B (100.00%) - LeetHub
Browse files Browse the repository at this point in the history
  • Loading branch information
joseantoniochacon committed Oct 2, 2024
1 parent 3512a40 commit d562a6d
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions 0626-exchange-seats/0626-exchange-seats.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Write your MySQL query statement below

SELECT CASE
WHEN MOD(id, 2) = 0 THEN id - 1
WHEN LEAD(id) OVER(ORDER BY id) IS NOT NULL THEN id + 1
ELSE id
END
AS id, student FROM Seat ORDER BY id;

0 comments on commit d562a6d

Please sign in to comment.