LeetCode 178: Rank Scores
Problem Description
Explanation
To rank the scores according to the rules provided, we can use the following steps:
- Create a temporary table that includes the unique scores and their counts in descending order.
- Use a variable to keep track of the current rank.
- Iterate through the temporary table and assign the rank to each score based on the previous count.
- Return the result table ordered by score in descending order.
Time complexity: O(nlogn) - sorting the scores table Space complexity: O(n) - storing the unique scores and counts
Solutions
# Write your Java solution here
Related LeetCode Problems
Loading editor...