From 570b19eab59782b962c691bde7f23230819823ed Mon Sep 17 00:00:00 2001 From: Maria Fernanda Azolin <49958403+azolinmf@users.noreply.github.com> Date: Thu, 29 Oct 2020 09:55:04 -0300 Subject: [PATCH] Create ClimbingTheLeaderboard.py --- problemSolving/ClimbingTheLeaderboard.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 problemSolving/ClimbingTheLeaderboard.py 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