Elegant solution without union or join


  • 0
    S
    select 
        least(id + 2*mod(id,2)-1, (select max(id) from seat)) AS id, 
        student
    from seat order by id
    

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.