Same score, same rank

Write code · Medium · §8.2 Writing binary search yourself

scores holds the scores of the people on this week's activity leaderboard, from the highest score down. A person's rank is the number of people with a higher score, plus 1. So people with the same score have the same rank.

asks holds the scores of the people who asked for their rank, and everyone who asked is on the leaderboard. Complete the function solution, which returns a list of the ranks in the order the people asked.

Function

solution(scores, asks)

Constraints

Examples

scoresasksresult
[95, 90, 90, 72, 60][72, 95][4, 1]
[85, 70, 70, 70, 56, 47, 40][56, 85][5, 1]

Starter code

def solution(scores, asks):
    answer = []
    return answer

Solve this problem in your browser

Python runs in your browser and checks your answer right away. Hints and the answer are on the problem page.