Complex but works


  • 0
    J
    select a.Score, cnt_less_equal as Rank
    from (select a.Id, a.Score, count(distinct b.Score) as cnt_less_equal
    from Scores a
      join Scores b
        on a.Score<=b.Score
    group by a.Id, a.Score) a
    order by Score desc
    

Log in to reply
 

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