An AC solution using one veriable

  • 0

    This solution use an extra variable to find the begin of each consecutive row, then check each row in the table to see if within three rows there is a row marked as the beginning of a consecutive row.

    select distinct,, s.people from stadium s, (select,, s1.people, @flag:=1 as flag from stadium s1, (select @flag := 0 ) temp where s1.people >= 100 and (select people from stadium s2 where = + 1)>=100 and (select people from stadium s3 where = + 2)>=100 ) temp2  where (flag = 1 and ( = - 1 or = -2 or =

Log in to reply

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