Exchange Seats
Medium
Interview Classics
Swap the seat ids of every two consecutive students. If the number of students is odd the last student keeps their seat. Return the rows ordered by id.
Table schema
Seat(id INT PRIMARY KEY, student VARCHAR(20))Sample data
id | student
1 | Abbot
2 | Doris
3 | Emerson
4 | Green
5 | Jeames
Discussion
No discussions yet.
Shalyam Support
Hi! Ask us anything — we'll reply on WhatsApp or Telegram within 24 hours.