File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed
HackerRank-Climbing the Leaderboard Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change 1+ #!/bin/python3
2+
3+ import math
4+ import os
5+ import random
6+ import re
7+ import sys
8+
9+ # Complete the climbingLeaderboard function below.
10+ def climbingLeaderboard (scores , alice ):
11+ scores = sorted (list (set (scores )))
12+ index = 0
13+ rank_list = []
14+ n = len (scores )
15+ for i in alice :
16+ while (n > index and i >= scores [index ]):
17+ index += 1
18+ rank_list .append (n + 1 - index )
19+ return rank_list
20+
21+
22+ if __name__ == '__main__' :
23+ fptr = open (os .environ ['OUTPUT_PATH' ], 'w' )
24+
25+ scores_count = int (input ())
26+
27+ scores = list (map (int , input ().rstrip ().split ()))
28+
29+ alice_count = int (input ())
30+
31+ alice = list (map (int , input ().rstrip ().split ()))
32+
33+ result = climbingLeaderboard (scores , alice )
34+
35+ fptr .write ('\n ' .join (map (str , result )))
36+ fptr .write ('\n ' )
37+
38+ fptr .close ()
You can’t perform that action at this time.
0 commit comments