← Atlassian Interview InsightsMachine Learning Engineer

Atlassian·Machine Learning Engineer·Technical Phone Screen·Intermediate

IntermediatePrefer not to say
Jun 2026

Summary

Interviewed for an ML Engineer role at Atlassian and got a sliding window question that felt more like a standard coding screen than anything ML-specific. Pretty straightforward round overall, nothing too surprising.

Questions Asked (1)

Q1

Design a MovingAverage class that takes a window size on initialization and, given a stream of integers, returns the average of the most recent N values each time a new value is added.

Algorithms & Data Structures
Author's notes

Went with a queue and a running sum so I wouldn't have to recompute the whole window every call.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the requirements: window size N, stream of integers, and return average of most recent N values. Then propose a solution using a queue (or circular buffer) to maintain the window and a running sum to compute the average in O(1) time per element. Discuss edge cases like when the window is not yet full and handling large streams efficiently.

Pro tip: Mention that you would use a fixed-size circular buffer to avoid the overhead of shifting elements in a standard queue, and emphasize that the running sum approach ensures O(1) time complexity per operation, which is crucial for high-throughput ML systems.

1. Clarify requirements and constraints

Ask about the expected window size, whether the stream is infinite, and if the average should be returned as a float or double. Confirm that only the most recent N values are considered.

2. Choose data structures

Select a queue (or circular buffer) to store the window and a variable to maintain the running sum. Explain why a circular buffer is more efficient than a standard queue for fixed-size windows.

3. Design the algorithm

Outline the add method: if the window is full, remove the oldest value and subtract it from the sum; add the new value and update the sum; then return sum divided by the current window size.

4. Analyze complexity and edge cases

State that each operation is O(1) time and O(N) space. Discuss edge cases: window not full, N=1, and potential integer overflow in the sum (use long or double).

5. Consider extensions and optimizations

Mention possible extensions like handling weighted averages or exponential moving averages, and how the design would change for distributed streams.

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 operation
  • Handling the initial phase when the window is not yet full
  • Space complexity O(N) and time complexity O(1) per element
  • Edge cases: N=1, large N, integer overflow, and empty stream
  • Potential for thread safety if used in concurrent environments

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