Inner Join solution


  • 0
    S
    SELECT DISTINCT t1.seat_id
    FROM cinema t1
        INNER JOIN cinema t2 ON (
                    (t2.seat_id = t1.seat_id + 1)
                    OR
                    (t1.seat_id = t2.seat_id + 1)
                )
                AND t1.free = 1 AND t2.free = 1
    ORDER BY t1.seat_id ASC
    

Log in to reply
 

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