← Atlassian Interview Insights

Atlassian·Machine Learning Engineer·Technical Phone Screen·Senior

Senior
May 2026

Summary

Atlassian ML Engineer interview with a streaming data problem that felt more like a systems thinking exercise than a pure coding question. The follow-up on weighted averages is where things got interesting.

Questions Asked (2)

Q1

You're given an integer N and an unbounded stream of integers arriving one at a time. After each new integer arrives, output the average of the last N integers. If fewer than N have arrived yet, average over everything seen so far. The solution should handle updates efficiently.

Algorithms & Data StructuresSystem Design
Author's notes

Circular buffer was the move and I got there eventually, but I spent an embarrassing amount of time second-guessing whether I needed a deque instead.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Use a circular buffer (or deque) to store the last N integers and maintain a running sum. For each new integer, add it to the sum, remove the oldest if the buffer exceeds N, and output the average as sum divided by the current count. This gives O(1) time per update and O(N) space.

Pro tip: Mention that this is a classic sliding window average problem and that the same pattern extends to weighted averages or exponential moving averages, which are common in ML feature pipelines. Also, clarify edge cases like N=1 or N=0 upfront to show attention to detail.

1. Clarify requirements and edge cases

Confirm N is a positive integer, discuss behavior for N=0 or N=1, and whether the stream can contain negative numbers or floats. This ensures the solution is robust.

2. Choose the right data structure

Select a circular buffer (fixed-size array with head/tail pointers) or a deque to efficiently add new elements and evict old ones in O(1) time.

3. Maintain a running sum

Keep a variable for the sum of elements currently in the buffer. On each new integer, add it to the sum and subtract the evicted element if the buffer is full.

4. Compute and output the average

After updating the sum and buffer, output sum divided by the current number of elements (which is min(count, N)). Handle division by zero if no elements have arrived.

5. Analyze complexity and discuss optimizations

State that each update is O(1) time and O(N) space. Mention potential optimizations like using a fixed-size array for cache efficiency or handling floating-point precision.

Key Points to Mention

  • Circular buffer or deque for O(1) insertion and removal
  • Running sum to avoid recomputing the average from scratch
  • Handling the initial phase when fewer than N elements have arrived
  • Edge cases: N=1, N=0, empty stream, negative numbers
  • Time complexity O(1) per update, space complexity O(N)
  • Relevance to ML: streaming averages for monitoring, feature engineering, or online learning

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

Q2

How would you redesign the solution if more recent values should carry more weight, for example using exponentially decaying weights or a custom weight vector over the last N elements?

Algorithms & Data StructuresTechnical Trade-offs
Author's notes

This is where I fumbled a bit.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the problem and the desired weighting scheme, then propose a concrete redesign using exponentially decaying weights or a custom weight vector. Discuss the algorithmic changes, data structures, and trade-offs (time/space complexity, numerical stability, and implementation complexity) compared to the original solution.

Pro tip: Mention that exponential decay can be implemented efficiently with a running weighted sum and a decay factor, but be cautious about numerical underflow and consider periodic renormalization. Also, relate the choice to the business context—Atlassian values practical, scalable solutions.

1. Clarify Requirements

Ask whether the weighting should apply to a fixed window (last N elements) or all history, and whether the decay rate is fixed or tunable. Confirm if the weights need to be normalized.

2. Choose Weighting Scheme

Decide between exponential decay (e.g., weight = α^(N-i)) and a custom weight vector (e.g., linear, polynomial, or learned weights). Justify the choice based on the use case and data characteristics.

3. Redesign Algorithm

Modify the original algorithm to incorporate weights. For exponential decay, use a running sum with a decay factor to achieve O(1) update and O(1) query. For custom weights, precompute the weight vector and compute the weighted sum over the window.

4. Analyze Trade-offs

Compare time and space complexity, numerical stability, and ease of implementation. Discuss how the new approach affects latency, memory, and accuracy, and whether it scales with data volume.

5. Validate and Iterate

Propose testing with synthetic and real data to tune parameters (e.g., decay factor) and validate performance. Mention monitoring and potential need for renormalization to avoid underflow.

Key Points to Mention

  • Exponential decay formula: w_i = α^(N-i) for i=1..N, where α is the decay factor (0<α<1).
  • Efficient implementation: maintain a running weighted sum and a running sum of weights, updating with each new element: S = α*S + x_new, W = α*W + 1, then weighted average = S/W.
  • Custom weight vector: precompute weights (e.g., linear, polynomial) and compute dot product with the window; may require O(N) per update if not optimized.
  • Trade-offs: exponential decay is O(1) per update and memory efficient, but may suffer from numerical underflow; custom weights offer flexibility but can be computationally heavier.
  • Numerical stability: use log-space or periodic renormalization to prevent underflow/overflow when α is small or N is large.
  • Business context: Atlassian values scalable, maintainable solutions; consider how the weighting aligns with product goals (e.g., recent activity in Jira).

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