← Atlassian Interview Insights

Atlassian·Software Engineer·Onsite - Coding / Algorithms·Intermediate

IntermediatePrefer not to say
Jun 2026

Summary

Atlassian software engineer interview with a system design coding problem that looked straightforward on the surface but had some real implementation teeth once you got into the details.

Questions Asked (1)

Q1

Design a data structure that supports four operations all in O(1) average time: increment a key's count, decrement a key's count (and remove it if it hits zero), get any key with the maximum count, and get any key with the minimum count.

Algorithms & Data StructuresSystem Design
Author's notes

I knew a hashmap alone wouldn't cut it for the max/min ops.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the requirements and constraints, then propose a design using a hash map for key-to-count lookup and a doubly linked list of buckets to group keys by count, enabling O(1) access to max and min. Explain how each operation updates the data structures in constant time, and discuss handling edge cases like decrementing to zero.

Pro tip: Mention that this is a classic problem (often called 'All O(1) Data Structure') and that the bucket approach is optimal; also note that using a balanced BST would give O(log n), so the linked list of buckets is key to achieving O(1).

1. Clarify requirements and assumptions

Ask about expected key types, whether counts can be negative, and if operations need to be thread-safe. Confirm that average O(1) is acceptable and that any max/min key is fine.

2. Propose high-level data structures

Suggest a hash map mapping keys to their count and a node in a doubly linked list of buckets, where each bucket represents a count and contains a set of keys with that count.

3. Detail operations for O(1) updates

Explain how increment moves a key to the next bucket (creating it if needed), decrement moves it to the previous bucket (removing if count becomes zero), and how max/min are obtained from the head/tail of the bucket list.

4. Handle edge cases and complexity

Discuss cases like incrementing a new key, decrementing a key with count 1, and maintaining empty buckets. Analyze time and space complexity, emphasizing O(1) average time per operation.

5. Summarize and invite feedback

Recap the design, highlighting how each operation achieves O(1), and ask if the interviewer wants to dive deeper into any part or consider alternative approaches.

Key Points to Mention

  • Hash map for O(1) key lookup and count retrieval
  • Doubly linked list of buckets ordered by count for O(1) max/min access
  • Bucket contains a set of keys with the same count, allowing O(1) add/remove
  • Increment/decrement operations move keys between adjacent buckets in O(1)
  • Removal of empty buckets to maintain list integrity
  • Average O(1) time achieved; worst-case O(1) for all operations with careful implementation

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.