← Atlassian Interview Insights
My first instinct was a hash map plus a max-heap and I just went with it before thinking through the decrement case.
Start by clarifying requirements (e.g., real-time vs. eventual consistency, scale, read/write ratio) and then propose a data structure like a hash map for counts plus a heap or balanced BST for most-popular. Discuss trade-offs (time/space complexity, concurrency) and then scale horizontally using sharding and aggregation.
Pro tip: Mention that exact real-time most-popular is hard at scale; propose approximate solutions (e.g., count-min sketch) or windowed popularity to balance accuracy and performance.
Ask about expected scale, read/write patterns, consistency needs, and whether popularity is global or per-region/time window.
Propose a hash map for counts and a max-heap or balanced BST for most-popular; analyze time complexity for increment, decrement, and lookup.
Discuss alternatives like sorted sets (Redis), skip lists, or approximate structures; compare update vs. lookup costs and memory.
Shard by content ID, use a distributed cache, and aggregate results; consider eventual consistency and fault tolerance.
Handle decrement to zero, hot keys, concurrency, and failure recovery; mention monitoring and backpressure.
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.