Accepted solution using left join and group by with 618ms


  • 0
    S
    select lt.Score, rt.Rank from Scores lt left join (select tmp.Score as Score, (@i:=@i+1) as Rank from (select c.Score from Scores c group by c.Score order by c.Score desc) tmp,(select @i:=0) it) rt  on lt.Score = rt.Score order by lt.Score desc;
    

Log in to reply
 

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