# Popping from Sorted Sets

> How do you atomically remove and return the member with the highest score from a Sorted Set, and how do you wait for one if the set is empty?

Canonical: https://www.internhack.in/learn/interview/redis-caching/redis-zpopmin-max
Last updated: 2026-11-28

Difficulty: Intermediate

## Question

How do you atomically remove and return the member with the highest score from a Sorted Set, and how do you wait for one if the set is empty?

*The full answer is for InternHack members. Open the page link above to read it.*

## Concepts covered

ZPOPMAX, ZPOPMIN, BZPOPMAX, ZMPOP, Priority queue

Previous: [Set Math: Intersection/Union](https://www.internhack.in/learn/interview/redis-caching/redis-set-operations) · Next: [LRU Accuracy](https://www.internhack.in/learn/interview/redis-caching/redis-max-memory-samples) · [All of Redis & Caching](https://www.internhack.in/learn/interview/redis-caching)

## More Redis & Caching questions

- [Core Data Types](https://www.internhack.in/learn/interview/redis-caching/redis-data-types)
- [Caching Strategies](https://www.internhack.in/learn/interview/redis-caching/redis-caching-strategies)
- [Eviction Policies](https://www.internhack.in/learn/interview/redis-caching/redis-eviction-policies)
- [Persistence: RDB vs. AOF](https://www.internhack.in/learn/interview/redis-caching/redis-persistence-rdb-aof)
- [Transactions & Atomicity](https://www.internhack.in/learn/interview/redis-caching/redis-transactions-multi)
- [Pub/Sub Messaging](https://www.internhack.in/learn/interview/redis-caching/redis-pub-sub)

## Related

- [Learn](https://www.internhack.in/learn)
- [Interview Prep](https://www.internhack.in/learn/interview)
- [Redis & Caching](https://www.internhack.in/learn/interview/redis-caching)
