Tripple inner join solution


  • 0
    T
    SELECT DISTINCT p1.Num FROM (SELECT log1.Num AS Num, log1.Id AS Id FROM Logs AS log1 INNER JOIN Logs AS log2 ON log1.Id = log2.Id - 1 AND log1.Num = log2.Num) p1 INNER JOIN Logs AS log3 ON p1.Id = log3.Id - 2 AND p1.Num = log3.Num;

  • 0
    M

    This solution may be wrong when the id is not successive.


Log in to reply
 

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