751 ms. solution


  • 0
    3
    select t2.Score, t1.Rank
    from (
    	SELECT a.Score,(@rowNum := @rowNum+1) as 'Rank'
    	from (
    		select DISTINCT Score
    		from Scores ) a
    	inner join (select (@rowNum := 0)) b
    	order by Score desc ) t1
    INNER JOIN Scores  t2 on t1.Score=t2.Score
    order by t2.Score desc

  • 0
    A

    Could you please explain how it execute? Thanks


Log in to reply
 

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