database 601 Human Traffic of Stadium


  • 0
    A

    select distinct id,date,people from (select a.id,a.date,a.people from stadium a
    left join stadium b on a.id-1=b.id
    left join stadium c on b.id-1=c.id
    where b.id is not null and c.id is not null
    and a.people>99 and b.people>99 and c.people>99
    union all
    select a.id,a.date,a.people from stadium a
    left join stadium b on a.id+1=b.id
    left join stadium c on b.id+1=c.id
    where b.id is not null and c.id is not null
    and a.people>99 and b.people>99 and c.people>99
    union all
    select a.id,a.date,a.people from stadium a
    left join stadium b on a.id-1=b.id
    left join stadium c on a.id+1=c.id
    where b.id is not null and c.id is not null
    and a.people>99 and b.people>99 and c.people>99)
    as tmp order by id
    is runtime too long?


Log in to reply
 

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