FastPrepDynamic Person Rankings
Problems/Dynamic Person Rankings

Dynamic Person Rankings

Google logoGoogle● HardNEW GRADONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The report gives unique names and scores, and the operations add, get-rank, and score-update. It needs both rank lookup and updates in less than linear time. Comments discuss balanced trees, sorted lists, and Fenwick trees. Here the operations come as one batch, and ranks start at one. Our version is about 90% the same as the reported question.

Process operations on a ranking of people with unique names and unique integer scores.

  • ADD name score inserts a new person.
  • UPDATE name score changes an existing person's score.
  • GET rank returns the person at the one-based rank, where rank 1 is the highest score.

Every operation is valid, and scores remain unique after each update. Return one string name:score for each GET, in operation order.

Function

processRankings(operations: String[][]) → String[]

Examples

Example 1

operations = [["ADD","alice","90"],["ADD","bob","70"],["GET","1"],["UPDATE","bob","95"],["GET","1"],["GET","2"]]return = ["alice:90","bob:95","alice:90"]

Alice starts first. Updating Bob to 95 moves him above Alice.

Example 2

operations = [["ADD","x","-5"],["ADD","y","10"],["ADD","z","0"],["GET","2"]]return = ["z:0"]

Scores in descending order are 10,0,-5.

Example 3

operations = []return = []

No operations produce no rank-query results.

Constraints

  • 0 <= operations.length <= 200000.
  • Names contain 1 through 20 letters or digits.
  • Scores are signed 32-bit integers.
  • GET ranks are valid for the current number of people.

More Google Onsite Interview questions

  • Route Pattern MatcherPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Evaluate a Nested Math ExpressionPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Distinct Subset SumsONSITE INTERVIEW · Seen Nov 2026
  • Playlist With No Same Artist in a RowONSITE INTERVIEW · Seen Nov 2026
  • Delete Nodes and Return Forest RootsONSITE INTERVIEW · Seen Nov 2026
  • Dice-Walk Winning ProbabilityPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • First and Last Target Position in a Mountain ArrayONSITE INTERVIEW · Seen Nov 2026
  • Lowest Common Ancestor in an N-ary TreePHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • 0/1 Knapsack with Weight and Volume LimitsONSITE INTERVIEW · Seen Nov 2026
  • Batched Subsequence Word MatchesONSITE INTERVIEW · Seen Nov 2026

Similar questions at other companies

  • Dynamic Fixed-K Score LeaderboardCoinbase · ONSITE INTERVIEWCoinbase interview questions
  • Volunteer Awards: Totals Divisible by KNutanix · ONSITE INTERVIEWNutanix interview questions
  • Crossed User Pairs on One DateRippling · ONSITE INTERVIEWRippling interview questions
  • Dynamic Fixed-K Score LeaderboardAnchorage · PHONE SCREEN
  • Segment QueriesTikTok · OATikTok interview questions
  • Colored Rooted TreeRubrik · ONSITE INTERVIEWRubrik interview questions
  • Highlight and Rank Overlapping CitationsHarvey · PHONE SCREEN · ONSITE INTERVIEWHarvey interview questions
  • Max Points on a LineLinkedIn · ONSITE INTERVIEWLinkedIn interview questions
  • LFU CacheAmazon · ONSITE INTERVIEW
  • Sparse Plant Infection SimulationOpenAI · PHONE SCREEN · ONSITE INTERVIEWOpenAI interview questions

Google interview experiences

  • Google interviews · November 2026
  • Google Software Engineer Onsite Questions: 10 Experiences
  • Google OA: What It Tests (2026)
  • Google L4 SWE Phone Screen: 1 Experience
  • Google ML Engineering Manager Onsite: 1 Experience
  • Google Experienced SWE First Round and Onsite: 1 Experience
All Google interview questionsSee Google hiring insights
Saved
class Solution {
    public String[] processRankings(String[][] operations) {
        // Write your code here.
    }
}
Checking account…