← Atlassian Interview InsightsMachine Learning Engineer

Atlassian·Machine Learning Engineer·Technical Phone Screen·Senior

SeniorPrefer not to say
Jun 2026Remote

Summary

Atlassian ML engineer interview with a data structures question that had a pretty meaty follow-up attached. The core problem was straightforward but the weighted average extension is where things got interesting and where I probably could have done better.

Questions Asked (2)

Q1

Design a data structure that, given a window size N and a stream of incoming integers, returns the rolling average of the last N values after each new value arrives. Walk through the time complexity of your approach.

Algorithms & Data StructuresSystem Design
Author's notes

Pretty clean once you land on a circular buffer with a running sum.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the problem requirements (e.g., handling of initial values, data types, and whether the window is fixed or sliding). Then propose a solution using a queue (or circular buffer) to maintain the last N values and a running sum to compute the average in O(1) time per element. Finally, analyze the time and space complexity, and discuss potential optimizations or edge cases.

Pro tip: Mention that for machine learning applications, you might need to handle numerical stability (e.g., using a running sum can cause floating-point drift) and consider using a more robust method like Welford's algorithm for variance, but for average, a simple sum is fine. Also, discuss how this scales to high-throughput streams.

1. Clarify requirements and constraints

Ask about the expected size of N, the range of integers, whether the stream is infinite, and if the average should be computed after each element or only when the window is full. Also, consider if the data structure needs to support other operations like reset or change window size.

2. Choose the right data structure

Use a queue (or a circular buffer) to store the last N elements. Maintain a running sum of the elements in the queue. When a new element arrives, add it to the sum and enqueue it; if the queue size exceeds N, dequeue the oldest element and subtract it from the sum.

3. Implement the rolling average logic

After each insertion, compute the average as the running sum divided by the current number of elements (or N if the window is full). Ensure that the average is updated in O(1) time per operation.

4. Analyze time and space complexity

Explain that each new element is processed in O(1) time (enqueue, dequeue, sum update, average calculation), and the space complexity is O(N) for storing the window. Compare with a naive approach that recomputes the sum each time (O(N) per element).

5. Discuss edge cases and extensions

Address cases like N=1, empty stream, or when the stream has fewer than N elements. Mention potential extensions: handling weighted averages, exponential moving averages, or using a ring buffer for memory efficiency.

Key Points to Mention

  • Use of a queue or circular buffer to maintain the sliding window.
  • Maintaining a running sum to achieve O(1) time per element.
  • Time complexity: O(1) per element, O(N) space.
  • Comparison with naive O(N) per element approach.
  • Handling of initial elements when window is not yet full.
  • Potential numerical stability issues with floating-point sums and possible mitigations.

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

Q2

How would you modify the design if you wanted to give more weight to recent values? Compare an exponentially weighted moving average using a smoothing factor against a linearly decaying weight scheme, and discuss the trade-offs around memory, parameter sensitivity, and how each responds to sudden changes in the input.

Technical Trade-offsAlgorithms & Data StructuresSystem Design
Author's notes

This is where I felt the ground shift a bit.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by framing the problem: you need a weighted moving average that emphasizes recent values. Then compare EWMA and linear decay across memory, parameter sensitivity, and responsiveness to sudden changes, using concrete examples and complexity analysis. Conclude with a recommendation based on the use case, highlighting trade-offs.

Pro tip: Mention that EWMA can be computed in O(1) time and memory with a single state variable, while linear decay typically requires storing a window of recent values, making it O(w) memory. Also, note that EWMA's smoothing factor α directly controls the effective window size (≈ 2/α - 1), which is a useful heuristic for parameter tuning.

1. Define the goal and baseline

State that you want to weight recent values more heavily and that a simple moving average (SMA) treats all values equally. Introduce EWMA and linear decay as two common weighting schemes.

2. Describe EWMA and its properties

Explain EWMA: new average = α * current value + (1-α) * previous average. Discuss how α controls the decay rate, memory usage (O(1)), and parameter sensitivity (small α = slow adaptation, large α = fast adaptation).

3. Describe linear decay and its properties

Explain linear decay: weights decrease linearly from most recent to oldest within a fixed window. Discuss memory usage (O(w)), parameter sensitivity (window size w), and how it responds to sudden changes (delayed but sharp).

4. Compare trade-offs

Contrast memory (O(1) vs O(w)), parameter sensitivity (α vs w), and responsiveness to sudden changes (EWMA reacts immediately but smoothly; linear decay reacts after a delay but can be more pronounced). Mention computational complexity.

5. Recommend based on use case

Suggest EWMA for streaming data with limited memory and when gradual adaptation is acceptable; suggest linear decay when you need a fixed window and more interpretable weights. Highlight that the choice depends on the application's requirements.

Key Points to Mention

  • EWMA formula and O(1) memory/time complexity
  • Linear decay requires storing a window of size w, O(w) memory
  • Parameter sensitivity: α in EWMA vs window size in linear decay
  • Responsiveness to sudden changes: EWMA reacts immediately but smoothly; linear decay has a delayed but potentially sharper response
  • Effective window size of EWMA: approximately 2/α - 1
  • Use cases: EWMA for streaming/online learning, linear decay for batch or when interpretability of weights matters

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