← Atlassian Interview Insights

Atlassian·Machine Learning Engineer·Technical Phone Screen·Intermediate

Intermediate
Jun 2026

Summary

Coding round for an ML Engineer role at Atlassian. One algorithmic problem, interval scheduling flavor, the kind of thing that sounds straightforward until you're actually trying to explain your greedy logic out loud.

Questions Asked (1)

Q1

Given a list of bookings each with a start and end time, assign them to courts such that no two bookings on the same court overlap. Return the minimum number of courts required and a valid assignment of bookings to courts.

Algorithms & Data Structures
Author's notes

Classic interval scheduling problem but the assignment part tripped me up a bit.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Model the problem as an interval graph coloring problem where the minimum number of courts equals the maximum number of overlapping bookings. Use a sweep-line algorithm to compute the maximum overlap and then assign courts greedily by sorting bookings by start time and using a min-heap of end times to track available courts.

Pro tip: Clarify whether bookings are half-open intervals (e.g., [start, end)) to avoid edge cases, and mention that the greedy assignment is optimal because interval graphs are perfect. Also, discuss how to handle ties in start times by sorting by end time as a secondary key.

1. Clarify interval semantics and constraints

Ask whether intervals are inclusive or half-open, and confirm that bookings are fixed (no rescheduling). This avoids off-by-one errors and sets clear assumptions.

2. Compute minimum courts via sweep-line

Create events for each start (+1) and end (-1), sort them, and track the running sum to find the maximum overlap. This gives the minimum number of courts required.

3. Assign bookings to courts greedily

Sort bookings by start time. Use a min-heap to track the earliest end time among assigned courts. For each booking, if the earliest end time <= start, reuse that court; otherwise, allocate a new court.

4. Validate and return the assignment

Verify that no two bookings on the same court overlap and that the number of courts used equals the maximum overlap. Return the list of courts with their bookings.

Key Points to Mention

  • Interval graph coloring and the equivalence to maximum overlap
  • Sweep-line algorithm for computing maximum overlap in O(n log n)
  • Greedy assignment using a min-heap of end times
  • Time and space complexity: O(n log n) time, O(n) space
  • Handling edge cases: empty list, single booking, simultaneous start/end
  • Proof of optimality: greedy choice property and interval graph perfection

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