Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to get all elements in the sorted set between 'a' and 'c' lexicographically.
Redis
ZRANGEBYLEX myzset [1] Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using parentheses instead of square brackets causes exclusive boundaries.
Mixing inclusive and exclusive boundaries incorrectly.
✗ Incorrect
Using [a [c includes elements from 'a' to 'c' inclusive in lexicographic order.
2fill in blank
mediumComplete the code to get elements lexicographically greater than 'b' but less than or equal to 'd'.
Redis
ZRANGEBYLEX myzset [1] Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using [b includes 'b' which is not desired here.
Using (d excludes 'd' which is not desired here.
✗ Incorrect
Using (b [d means elements greater than 'b' (exclusive) up to 'd' inclusive.
3fill in blank
hardFix the error in the code to correctly get elements from 'a' inclusive to 'z' exclusive.
Redis
ZRANGEBYLEX myzset [1] Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using (a excludes 'a' which is not desired.
Using [z includes 'z' which is not desired.
✗ Incorrect
To include 'a' and exclude 'z', use [a (z).
4fill in blank
hardFill both blanks to get elements lexicographically between 'm' exclusive and 't' inclusive.
Redis
ZRANGEBYLEX myzset [1] [2]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using [m includes 'm' which is not desired.
Using (t excludes 't' which is not desired.
✗ Incorrect
Use (m to exclude 'm' and [t to include 't' in the range.
5fill in blank
hardFill all three blanks to get elements from 'a' inclusive to 'z' exclusive, limiting to first 5 results.
Redis
ZRANGEBYLEX myzset [1] [2] LIMIT [3] 5
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using [z includes 'z' which is not desired.
Using wrong offset for LIMIT.
✗ Incorrect
Use [a for inclusive start, (z for exclusive end, and 0 as offset for LIMIT.