Using Sorted Sets for Leaderboards

Welcome to the next exciting part of our Redis-based backend system project. In this unit, we will focus on building leaderboard functionality using Redis's sorted sets. Building a leaderboard is a popular use case for many applications, such as games and competitive platforms. You’ve got a good grasp of managing user data from previous lessons, so let’s build on that foundation.

What You'll Build

A leaderboard is a vital feature in competitive applications like games, designed to rank users based on specific metrics such as scores or achievements. It fosters motivation and competition among users. In this unit, our primary focus will be:

  1. Adding user scores to a leaderboard: We will store user scores using Redis sorted sets with hiredis.
  2. Retrieving the leaderboard: We will fetch and display the top users and their scores.
  3. Getting a user's rank and score: We will retrieve the ranking and score of a specific user.

Below are some key parts of the C++ code you will be working with to perform these tasks.

Sign up
Join the 1M+ learners on CodeSignal
Be a part of our community of 1M+ users who develop and demonstrate their skills on CodeSignal