PracHub
QuestionsPremiumLearningGuidesCheatsheetNEWCoaches
|Home/Coding & Algorithms/Atlassian

Design a rating aggregator that returns totals and averages

Last updated: Mar 29, 2026

Quick Overview

This question evaluates a candidate's competency in designing and implementing data structures and algorithms for maintaining dynamic aggregates (total counts, sums, and averages) across user-item ratings while handling additions, updates, and removals.

  • medium
  • Atlassian
  • Coding & Algorithms
  • Software Engineer

Design a rating aggregator that returns totals and averages

Company: Atlassian

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Technical Screen

Design and implement a simple rating system (like movie/book reviews) that supports adding ratings and querying summary statistics. #### Requirements Implement a data structure/class that supports the following operations: - `addRating(itemId, userId, score)`: user gives an item a numeric rating. - `updateRating(itemId, userId, newScore)`: user updates their rating (if it exists). - `removeRating(itemId, userId)`: user deletes their rating (if it exists). - `getItemStats(itemId)`: return at least: - total number of ratings - sum of scores - average score #### Notes - `score` is an integer in `[1, 5]`. - Multiple users can rate the same item, but each `(itemId, userId)` pair should have at most one active rating. - Aim for efficient updates and queries. You may assume item and user IDs are strings or integers. Provide the time/space complexity of each operation.

Quick Answer: This question evaluates a candidate's competency in designing and implementing data structures and algorithms for maintaining dynamic aggregates (total counts, sums, and averages) across user-item ratings while handling additions, updates, and removals.

Related Interview Questions

  • Compute a moving average on a stream - Atlassian (hard)
  • Find a secret word using match feedback - Atlassian (hard)
  • Implement sliding-window rate limiter function - Atlassian (medium)
  • Merge intervals and design rating APIs - Atlassian (medium)
  • Implement sequential and parallel URL requests - Atlassian (medium)
Atlassian logo
Atlassian
Jan 22, 2026, 12:00 AM
Software Engineer
Technical Screen
Coding & Algorithms
2
0
Loading...

Design and implement a simple rating system (like movie/book reviews) that supports adding ratings and querying summary statistics.

Requirements

Implement a data structure/class that supports the following operations:

  • addRating(itemId, userId, score) : user gives an item a numeric rating.
  • updateRating(itemId, userId, newScore) : user updates their rating (if it exists).
  • removeRating(itemId, userId) : user deletes their rating (if it exists).
  • getItemStats(itemId) : return at least:
    • total number of ratings
    • sum of scores
    • average score

Notes

  • score is an integer in [1, 5] .
  • Multiple users can rate the same item, but each (itemId, userId) pair should have at most one active rating.
  • Aim for efficient updates and queries.

You may assume item and user IDs are strings or integers.

Provide the time/space complexity of each operation.

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Atlassian•More Software Engineer•Atlassian Software Engineer•Atlassian Coding & Algorithms•Software Engineer Coding & Algorithms
PracHub

Master your tech interviews with 7,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.