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.
Climbing the Leaderboard
Climbing the Leaderboard
Sort by
recency
|
2359 Discussions
|
Please Login in order to post a comment
This short Python solution takes advantage of the fact that the player scores are listed in ascending order. We first make a sorted list of unique leader scores, then for each player score, removing the elements which are smaller than the player score, the length of the remaining leader scores plus one is thus the rank of the player score. The process is continued with the shorten leader scores list, thus saves a lot of steps.
My code doesn't pass the execution time limits, does anyone know why?. Here it is:
Simple solution using STL:lowerbound