178. Rank Scores

  • 0

    #It is faster because I have a subquery that "uniquifies" the scores first. Not entirely sure why #it's faster,
    #I'm guessing MySQL makes temp a temporary table and uses it for every outer Score.

    (SELECT count(*) FROM (SELECT distinct Score s FROM Scores) temp WHERE s >= Score) Rank
    FROM Scores
    ORDER BY Score desc

Log in to reply

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