InterviewDB
Question
Counter: Implement a Thread-Safe Multi-Key Counter with Atomic Increment and Reset
phone
Question Details
Problem Implement a Counter class that maps string keys to integer counts. It must support: increment(key, amount=1), decrement(key, amount=1), reset(key), get(key), and top_k(k) (returns k keys with highest counts). All operations must be thread-saf…
Full Details
🔒
Unlock full leaked content
Full insider details, leaked discussions, and candidate experiences.
Get Premium →Topics
Coding
Onsite
Phone