1. Prepend (left)
LPUSH adds an element to the head (left) of the list, creating the list if it does not exist.
LPUSH jobs "a"Typorithm · easy
Step 1 of 8 · intro card
Data Types
A Redis list is an ordered sequence of strings. LPUSH prepends and RPUSH appends, so pairing LPUSH with RPOP gives a simple FIFO job queue.
Redis lists are ordered, linked sequences of string elements. You add from either end: LPUSH pushes onto the head (left) and RPUSH pushes onto the tail (right).
Combining LPUSH to add work and RPOP to take it off the other end yields first-in, first-out (FIFO) order — the classic job-queue pattern. LRANGE jobs 0 -1 reads every element from first to last.
LLEN reports the list's length. Because pushes and pops at the ends are O(1), lists are a fast, lightweight backbone for queues and recent-activity feeds.
Lists are ordered string sequences.
LPUSH prepends, RPUSH appends.
LPUSH + RPOP = FIFO queue.
LPUSH jobs "a"
RPUSH jobs "b"
LRANGE jobs 0 -1
RPOP jobs
LLEN jobsConnect each part of the code to the concept before you type.
LPUSH adds an element to the head (left) of the list, creating the list if it does not exist.
LPUSH jobs "a"RPUSH adds an element to the tail (right) of the list — the opposite end from LPUSH.
RPUSH jobs "b"LRANGE returns a slice by index; 0 to -1 spans from the first to the last element, i.e. the whole list.
LRANGE jobs 0 -1RPOP removes and returns the tail element; pairing LPUSH with RPOP gives FIFO queue order.
RPOP jobsLLEN returns the number of elements currently in the list.
LLEN jobsRead the concept map and follow the code breakdown.
Type the implementation, repair mistakes and work through every recall exercise.
Use the final check without hints; revisit weak concepts in short practice sessions.