Feature 3: Recommend Content Based on User's Age
Challenge: Real-time User Age Median for Content Filtering
We're building a system to recommend content based on user age. To personalize recommendations effectively, we need to determine the median age of users in a specific region in real time.
Since the user base is constantly growing, we require a data structure that efficiently updates the median age as new users sign up. This involves continuously adding user ages and keeping track of the central value.
Here, we can explore using a data structure like a heap to maintain the sorted order of user ages and efficiently calculate the median after each addition.
Similar problem on LeetCode: Find Median from Data Stream