My solution-with 1106ms


  • 0
    Y

    The first time My-Runtime of sql over the average:
    Runtime: 1106 ms

    select Id from (
    select Id, case when Temperature > @prev and datediff(Date, @preDate) = 1 then 1 else 0 end flag, case when Temperature!=0 then @prev:=Temperature else @prev:=Temperature end temp,
    case when Temperature!=0 then @preDate:=Date else @preDate:=Date end temp1
    from
    Weather ,
    (select @prev:=99999999999)r,
    (select @preDate:='1970-01-01')r1
    order by Date
    )a where flag=1;


Log in to reply
 

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