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
|
2350 Discussions
|
Please Login in order to post a comment
var poistion_array = []
var poistion_dic = {}
var poistion = 1 for (var i = 0; i < ranked.length ; i++){
}
var previous_index = ranked.length - 1 for (var i = 0; i < player.length; i++){
} console.log(poistion_array) return poistion_array }
Python Method : Using bisect to find the insert point and also is the new rank. However, sorted array must be the ascending because of bisect. Thus, I first delete duplicated scores so that rank number can be corresponding to the
len(ranked)-index
, and then re-sort it. Next, use bisect_right to find the insert point. When you get the insert point, you need toplus one
for correcting rank number (rarher than index value).def climbingLeaderboard(ranked, player):
JS/Javascript solution:-