We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
You can assume that the list of scores from the player will always be in ascending order. It would be nice to know that as part of the criteria.
As an alternative, you could probably turn the player scores into pairs with their array index, sort them ascending, and then map the ranks to the pair's index to ensure correct ordering even if scores are out of order. That would be a real world-ish scenario.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Climbing the Leaderboard
You are viewing a single comment's thread. Return to all comments →
You can assume that the list of scores from the player will always be in ascending order. It would be nice to know that as part of the criteria.
As an alternative, you could probably turn the player scores into pairs with their array index, sort them ascending, and then map the ranks to the pair's index to ensure correct ordering even if scores are out of order. That would be a real world-ish scenario.