Sharing my solution


  • 0
    M
    select distinct(Logs.Num) as triplets
    from Logs inner join
    (select logs1.Id as id1, logs2.id as id2, logs1.Num as Num from
        Logs as logs1 inner join Logs as logs2 on logs1.Id = logs2.Id - 1
        where logs1.Num = logs2.Num) as doubles
    
    on Logs.Id = doubles.id1 + 2
    where doubles.Num = Logs.Num;

  • 0
    O

    sorry, I made an answer by mistake.


Log in to reply
 

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