PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep
|Home/Coding & Algorithms/Atlassian

Compute moving average over last N stream

Last updated: Mar 29, 2026

Quick Overview

This question evaluates understanding of streaming algorithms and sliding-window aggregation within the Coding & Algorithms domain, focusing on incremental computation, state management, and numerical stability when computing moving averages.

  • medium
  • Atlassian
  • Coding & Algorithms
  • Machine Learning Engineer

Compute moving average over last N stream

Company: Atlassian

Role: Machine Learning Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Onsite

You are given an integer N and an unbounded stream of integers arriving one by one. After each new integer arrives, output the average of the last N integers seen so far. Requirements: - If fewer than N integers have arrived, average over all integers seen so far. - The solution should support efficient updates per element. Follow-up: - How would you modify the design if more recent numbers should have higher weight (e.g., exponentially decaying weights or a custom weight vector over the last N items)?

Quick Answer: This question evaluates understanding of streaming algorithms and sliding-window aggregation within the Coding & Algorithms domain, focusing on incremental computation, state management, and numerical stability when computing moving averages.

Related Interview Questions

  • Find a secret word using match feedback - Atlassian (hard)
  • Compute a moving average on a stream - Atlassian (hard)
  • Implement sequential and parallel URL requests - Atlassian (medium)
  • Implement sliding-window rate limiter function - Atlassian (medium)
  • Merge intervals and design rating APIs - Atlassian (medium)
Atlassian logo
Atlassian
Nov 21, 2025, 12:00 AM
Machine Learning Engineer
Onsite
Coding & Algorithms
1
0

You are given an integer N and an unbounded stream of integers arriving one by one. After each new integer arrives, output the average of the last N integers seen so far.

Requirements:

  • If fewer than N integers have arrived, average over all integers seen so far.
  • The solution should support efficient updates per element.

Follow-up:

  • How would you modify the design if more recent numbers should have higher weight (e.g., exponentially decaying weights or a custom weight vector over the last N items)?

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Atlassian•More Machine Learning Engineer•Atlassian Machine Learning Engineer•Atlassian Coding & Algorithms•Machine Learning Engineer Coding & Algorithms
PracHub

Master your tech interviews with 8,000+ 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.