Climbing the Leaderboard Problem Statement

In a game leaderboard, scores determine rankings where the highest score gets rank 1. Players with identical scores share the same rank, followed by the next rank down for following players. Given a list of game scores for a player through 'M' rounds, determine the player's leaderboard rank for each score.

Example:

Input:
N = 7
Leaderboard Scores = [100, 90, 90, 80, 75, 60, 50]
M = 3
Game Scores = [55, 65, 77]
Output:
[6, 5, 4]
Explanation:

For each game score:

  • Score 55 yields rank 6
  • Score 65 yields rank 5
  • Score 77 yields rank 4

Constraints:

  • 1 ≤ T ≤ 50
  • 1 ≤ N ≤ 104
  • 1 ≤ M ≤ 103
  • 0 ≤ LEADERBOARD_SCORE[i] ≤ 109
  • 0 ≤ PLAYER_SCORE[i] ≤ 109

Note the following conditions as well:

  • The leaderboard scores are given in descending order.
  • The player game scores are given in ascending order.

There is no need to print the output as it is already handled in the prompt. Implement the function to solve the problem.

Be the first one to answer
Add answer anonymously...
Goldman Sachs Software Analyst Interview Questions
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+

Reviews

4 L+

Interviews

4 Cr+

Salaries

1 Cr+

Users/Month

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter