Atlassian SDE 2

atlassian logo
atlassian
· SDE 2· India· 3y exp· No Offer
April 6, 2026 · 3 reads

Summary

I was presented with a challenging problem to design a class for tracking content popularity from a continuous stream of actions and retrieving the most popular content ID efficiently.

Full Experience

During my interview round, I was given a data structures and algorithms problem. The interviewer asked me to implement a class that could manage content popularity based on a stream of incoming actions. The key was to efficiently handle both increasing and decreasing popularity for specific content IDs, and then, at any point, be able to return the ID of the most popular content. This required careful consideration of data structures to ensure real-time performance for all operations.

Interview Questions (1)

1.

Most Popular Content ID from Stream

Data Structures & Algorithms·Medium

Imagine you are given a stream of content IDs along with an associated action to be performed on them.
Examples of contents are video, pages, posts etc.
There can be two actions associated with a content ID:

  • increasePopularity: increases the popularity of the content by 1. The popularity increases when someone comments on the content or likes the content.
  • decreasePopularity: decreases the popularity of the content by 1. The popularity decreases when a spam bot’s/user's comments are deleted from the content or its likes are removed from the content.
Content IDs are positive integers.
Implement a class that can return the mostPopular content ID at any time while consuming the stream of content IDs and its associated action. If there are no content IDs with popularity greater than 0, return -1.

📣 Found this helpful? Please share it with friends who are preparing for interviews!

Discussion (0)

Share your thoughts and ask questions

Join the Discussion

Sign in with Google to share your thoughts and ask questions

No comments yet

Be the first to share your thoughts and start the discussion!