Climbing the Leaderboard

  • + 1 comment

    python 3 solution working backwards to find idx

    updated_ranked = sorted(list(set(ranked)), reverse=True)
        result = []
        idx = len(updated_ranked) - 1
        for p in player:
            while True:
                if updated_ranked[idx] > p:
                    result.append(idx+2)
                    break
                elif idx == 0:
                    result.append(1)
                    break
                else:
                    idx = idx - 1
        return result