AC using self join


  • 2
    K
    select distinct a.seat_id
    from cinema a
    join cinema b
    on abs(a.seat_id - b.seat_id) = 1
    and a.free=true and b.free=true
    order by a.seat_id;
    

Log in to reply
 

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