diff --git a/problemSolving/ClimbingTheLeaderboard.py b/problemSolving/ClimbingTheLeaderboard.py new file mode 100644 index 0000000..5d95c1d --- /dev/null +++ b/problemSolving/ClimbingTheLeaderboard.py @@ -0,0 +1,14 @@ +# https://www.hackerrank.com/challenges/climbing-the-leaderboard/problem + +def climbingLeaderboard(scores, alice): + scores = sorted(list(set(scores))) + ranking = [] + n = len(scores) + + pos = 0 + for i in alice: + while (n > pos and i >= scores[pos]): + pos += 1 + ranking.append(n+1-pos) + + return ranking