Need help in debugging this solution


  • 0
    Y

    I was wondering what is wrong in this logic. It passes 6/14 tests

    SELECT Score, CASE
    WHEN @prev_value = Score THEN @rank_count
    WHEN @prev_value := Score THEN @rank_count := @rank_count + 1
    END AS Rank
    FROM Scores,(SELECT @prev_value = NULL,@rank_count = 0) t1
    ORDER BY Score Desc;

    Thanks


Log in to reply
 

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