← Atlassian Interview Insights

Atlassian·Software Engineer·Technical Phone Screen·Intermediate

Intermediate
Apr 2026

Summary

Atlassian SWE interview with a scheduling problem that looks deceptively simple until you realize they want the actual court assignments, not just the count. Pretty classic interval scheduling territory but with an extra layer.

Questions Asked (1)

Q1

Given a list of tennis court bookings (each with an id, start time, and end time), assign each booking to a court so no two bookings on the same court overlap, using the fewest courts possible. Return the full assignment of booking to court.

Algorithms & Data Structures
Author's notes

I knew meeting-rooms II but for a second I started going down the path of just counting the max overlaps and forgot they wanted the actual mapping back.

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. Sort bookings by start time and use a min-heap of court end times to assign each booking to an available court, reusing courts when possible and allocating new ones only when necessary.

Pro tip: Mention that the greedy algorithm is optimal because the maximum overlap gives a lower bound and the algorithm achieves it. Also, clarify that if the problem asks for the fewest courts, the number is fixed, but the assignment may vary; focus on producing a valid assignment with that minimum number.

1. Understand the problem and constraints

Restate the problem: assign bookings to courts such that no two bookings on the same court overlap, using the fewest courts. Clarify input format, whether times are given as intervals, and if bookings are sorted.

2. Identify the core algorithmic problem

Recognize this as interval graph coloring, where the minimum number of courts equals the maximum number of overlapping bookings. This equivalence is key to proving optimality.

3. Design the greedy algorithm

Sort bookings by start time. Use a min-heap to track the end times of the last booking on each court. For each booking, if the earliest ending court is free (end time <= start time), assign it there and update the heap; otherwise, allocate a new court.

4. Implement and handle edge cases

Write code to perform the assignment, ensuring correct handling of simultaneous start/end times (e.g., a booking ending at 10:00 and another starting at 10:00 do not overlap). Track court IDs and return the mapping.

5. Analyze complexity and verify

State time complexity O(n log n) due to sorting and heap operations, and space O(n). Walk through a small example to verify correctness and optimality.

Key Points to Mention

  • Interval graph coloring and the equivalence to maximum overlap
  • Greedy algorithm with sorting by start time and min-heap of end times
  • Optimality proof: maximum overlap is a lower bound and the algorithm achieves it
  • Time and space complexity analysis (O(n log n) time, O(n) space)
  • Handling edge cases: simultaneous start/end times, empty input, single booking
  • Returning the full assignment mapping each booking ID to a court ID

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