← Atlassian Interview Insights

Atlassian·Machine Learning Engineer·Technical Phone Screen·Senior

Senior
May 2026

Summary

Atlassian ML Engineer interview that was pretty much one meaty design question with a follow-up that kept going. The core problem was straightforward but the conversation spiraled into weighted average territory fast and I wasn't totally prepared for that part.

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. What's the time complexity per update?

Algorithms & Data StructuresSystem Design
Author's notes

Got through this fine.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements (e.g., handling initial values, N=0, memory constraints) and then propose a circular buffer (ring buffer) of size N to store the last N values, along with a running sum. After each new value, update the sum by subtracting the oldest value (if buffer is full) and adding the new value, then compute the average as sum / min(count, N). This yields O(1) time per update and O(N) space.

Pro tip: Mention that for ML pipelines, this can be extended to weighted moving averages or exponential moving averages, and that the O(1) update is crucial for real-time feature engineering. Also, note that using a fixed-size array avoids dynamic memory allocation overhead.

1. Clarify Requirements

Ask about edge cases: what if fewer than N values have arrived? Should the average be over available values or return None? Also confirm N is fixed and positive, and discuss memory constraints.

2. Choose Data Structure

Propose a circular buffer (array of size N) with a pointer to the oldest element, plus a running sum. Alternatively, a queue (e.g., deque) but circular buffer is more memory efficient.

3. Define Update Logic

For each new value: if buffer is full, subtract the oldest value from sum and overwrite it; else increment count. Add new value to sum and store it. Then compute average = sum / min(count, N).

4. Analyze Complexity

Each update does constant work: one subtraction, one addition, one division, and pointer update. So time complexity is O(1) per update. Space complexity is O(N) for the buffer.

5. Discuss Extensions and Trade-offs

Mention handling of integer overflow (use long or double for sum), thread-safety if needed, and alternatives like maintaining a balanced BST for median but not needed here. Also note that if N is large, O(N) space might be a concern.

Key Points to Mention

  • Circular buffer (ring buffer) implementation details: array, head pointer, count.
  • Running sum to avoid O(N) recomputation each time.
  • Time complexity O(1) per update, space complexity O(N).
  • Edge cases: initial fill, N=0, negative numbers, integer overflow.
  • Comparison with alternative approaches (e.g., queue, list) and why circular buffer is optimal.
  • Relevance to ML: real-time feature computation, streaming data, and potential extensions to weighted averages.

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 to give more weight to recent values? Walk through both an exponentially weighted moving average and a linearly decaying weight scheme, and compare the trade-offs between those approaches and the equal-weight rolling average.

Technical Trade-offsAlgorithms & Data Structures
Author's notes

This is where I started sweating.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the goal of weighting recent values and the context (e.g., streaming data, concept drift). Then explain EWMA and linear decay with formulas, and compare them to equal-weight rolling average in terms of responsiveness, memory, and bias-variance trade-off. Conclude with a recommendation based on the use case.

Pro tip: Mention that EWMA can be computed incrementally with O(1) memory and is equivalent to a weighted average with exponentially decaying weights, which is often preferred in production for its simplicity and adaptability.

1. Clarify the objective and context

Ask or state the purpose: to emphasize recent data due to non-stationarity or concept drift. Mention the need to balance responsiveness and stability.

2. Explain EWMA

Define EWMA formula: S_t = α * x_t + (1-α) * S_{t-1}, where α is smoothing factor. Discuss how α controls the weight decay and effective window size.

3. Explain linear decay weighting

Describe a scheme where weights decrease linearly with age, e.g., w_i = (N - i + 1) / sum_{j=1}^N j for a window of size N. Mention that it requires storing the window.

4. Compare trade-offs with equal-weight rolling average

Contrast: equal-weight is simple, unbiased for stationary data, but slow to adapt. EWMA is memory-efficient, highly responsive, but introduces bias towards recent values. Linear decay offers a middle ground but needs a fixed window and more memory.

5. Recommend based on use case

Suggest EWMA for streaming with limited memory and high adaptability; linear decay for batch with moderate recency emphasis; equal-weight for stationary data where all points are equally informative.

Key Points to Mention

  • EWMA formula and the role of smoothing factor α (or half-life).
  • Linear decay weights: w_i ∝ (N - i + 1) for a window of size N.
  • Memory and computational complexity: EWMA is O(1), linear decay O(N), equal-weight O(N) or O(1) with a circular buffer.
  • Responsiveness vs. stability: EWMA reacts quickly but can be noisy; equal-weight is stable but slow to adapt.
  • Bias-variance trade-off: EWMA has higher variance but lower bias for recent changes; equal-weight has lower variance but higher bias under drift.
  • Effective window size: for EWMA, it's approximately 1/α; for linear decay, it's N.

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