0
0
Redisquery~10 mins

Leaderboard implementation in Redis - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to add a user with a score to the leaderboard.

Redis
ZADD leaderboard [1] user123
Drag options to blanks, or click blank then click option'
A1500
Bleaderboard
CZADD
DSCORE
Attempts:
3 left
💡 Hint
Common Mistakes
Putting the member name before the score
Using a string instead of a number for the score
2fill in blank
medium

Complete the code to get the top 3 users from the leaderboard.

Redis
ZREVRANGE leaderboard 0 [1] WITHSCORES
Drag options to blanks, or click blank then click option'
A2
B3
C1
D0
Attempts:
3 left
💡 Hint
Common Mistakes
Using 3 as the end index which returns 4 users
Using 1 as the end index which returns only 2 users
3fill in blank
hard

Fix the error in the code to increment a user's score by 50.

Redis
ZINCRBY leaderboard [1] user123
Drag options to blanks, or click blank then click option'
AINCR
Bleaderboard
CZINCRBY
D50
Attempts:
3 left
💡 Hint
Common Mistakes
Using the command name as an argument
Putting the member name before the increment
4fill in blank
hard

Fill both blanks to remove a user from the leaderboard and then check if the user still exists.

Redis
ZREM leaderboard [1]
ZSCORE leaderboard [2]
Drag options to blanks, or click blank then click option'
Auser123
Buser456
Duser789
Attempts:
3 left
💡 Hint
Common Mistakes
Using different user names in the two commands
Using a user name that was never added
5fill in blank
hard

Fill all three blanks to create a leaderboard, add two users, and get the rank of one user.

Redis
ZADD [1] 1000 [2] 1500 [3]
ZRANK [1] [2]
Drag options to blanks, or click blank then click option'
Aleaderboard
BuserA
CuserB
DuserC
Attempts:
3 left
💡 Hint
Common Mistakes
Using different leaderboard names in commands
Mixing up user names in add and rank commands