Climbing the Leaderboard

  • + 0 comments

    be careful with the time limit exceed, so annoying

    the program should be sort desc (start from last)

    ranked = sorted(set(ranked), reverse=True)
        
        res = []
        i = len(ranked) - 1  # Start from the last element in the ranked list
    
        for score in player:
            while i >= 0 and score >= ranked[i]:
                i -= 1
            res.append(i + 2) 
        
        return res