Close
Topic list
MEDIUM
15 mins
Binary Search
Arrays
Topics (Covered in this problem)
Problem solved
Skill meter
Binary Search
-
-
Arrays
-
-
Other topics
Problem solved
Skill meter
Strings
-
-
Matrices (2D Arrays)
-
-
-
-
Sorting
-
-
Stacks & Queues
-
-
Trees
-
-
Graph
-
-
Dynamic Programming
-
-
Greedy
-
-
Tries
-
-
SQL
-
-
Binary Search Trees
-
-
Heap
-
-
Bit Manipulation
-
-
Solve problems & track your progress
Checkout your overall progress in every topic here
Become
Sensei
in DSA topics
Open the topic and solve more problems associated with it to improve your skills
Check out the skill meter for every topic
See how many problems you are left with to solve for cracking any stage. Score more than zero to get your progress counted.

Contributed by
Dhruv Sharma
Medium
0/80
Avg time to solve 15 mins
Success Rate 80 %
Share

## Problem Statement

#### You are given game scores of a player of ‘M’ rounds. Your task is to return the position obtained in each round.

##### Note:
``````The leaderboard scores are in descending order.
The game scores are given in ascending order.
``````
Detailed explanation ( Input/output format, Notes, Constraints, Images )
##### Sample Input 1:
``````2
7
100 100 50 40 40 20 10
4
5 25 50 120
6
100 90 90 80 75 60
5
50 65 77 90 102
``````
##### Sample Output 1:
``````6 4 2 1
6 5 4 2 1
``````
##### Explanation of sample input 1:
``````Test case 1:

Leaderboard Scores: 100   100   50   40   40   20   10
Ranks          :     1    1     2    3    3    4    5

Since 2 players scored 100, they get rank 1. Also, 2 players scored 40 and hence have the same rank, i.e rank 3. While others received different rankings according to their scores.

For the first round player scores 5 points, the player will stand at a position after the player at position 5 because the score is less than 10. So, the player gets position 6.

For the second round player scores 25 points, the player will stand after the player at position 3 and before the player at position 4. So, gets position 4, shifting the other players by 1 position.

The same goes for other rounds.

Test case 2:

Leaderboard Scores: 100    90    90    80    75    60
Ranks            :   1     2     2     3     4     5

So, 50 points will get position 6.
65 points will get position 5
And so on.
``````
##### Sample Input 2:
``````1
5
80 66 54 42 30
3
45 55 65
``````
##### Sample Output 2:
``````4 3 3
``````
Auto
Console