Google | L5 | coding round | design mini leaderboard

Design a mini leaderboard. It should have the following methods.

  1. insert(uid) - inserts a new user id into the mini leaderboard
  2. update(uid, score) - updates the score of the given user id with score
  3. topk() - returns top k userids and their scores
  4. getWindow(uid, k) - return k userids around the given uid. Preferrably, the given uid can be placed in the middle if possible.
Comments (4)