178. Rank Scores- runtime 845 ms

  • 0

    my accepted solution:
    select Score,CAST((case when @prevRank=Score then @rank when @prevRank:=Score then @rank:=@rank+cast(1 as signed) else @rank:=@rank+1 end) as signed) as Rank from Scores,(select @rank:=0,@prevRank:=null) r order by Score desc;

Log in to reply

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