13 / 14 test cases passed. Failed on the last long data set.


  • 0
    H
    # Write your MySQL query statement below
    SELECT Distinct n.Id
    FROM Weather p
    Join Weather n
    WHERE n.Temperature > p.Temperature
    AND n.Date - 1 = p.Date

  • 6
    Z

    For last case, '1998-11-01' minus one would be '1998-11-00' instead of '1998-10-31'.
    So the way to fix it is to replace your 'n.Date - 1 = p.Date' with 'DATE_SUB(n.Date,INTERVAL 1 DAY) = p.Date'


Log in to reply
 

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