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.
def climbingLeaderboard(ranked, player):
ranked = sorted(set(ranked),reverse=True)
index = len(ranked) - 1
output = []
for i in player:
while index >= 0 and i >= ranked[index]:
index -= 1
output.append(index+2)
return output
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 →
def climbingLeaderboard(ranked, player): ranked = sorted(set(ranked),reverse=True) index = len(ranked) - 1 output = [] for i in player: while index >= 0 and i >= ranked[index]: index -= 1 output.append(index+2)
return output