−65% Most banks now $169 $59.
Coding · 8 min read

Atlassian's 3-Part Tennis Court Coding Question

Atlassian coding rounds take a familiar interval problem and add realistic operational rules one at a time. This tennis court question starts as minimum-rooms scheduling, then maintenance changes when a court is free. Here is the full question, Java for all three parts, and the rubric.


The question

Given tennis court bookings with start and finish times, assign each booking to a court so no court hosts two bookings at once, using the minimum number of courts (unlimited courts available).

Part 2: after each booking a court needs a fixed time X of maintenance before reuse. Part 3: a court needs maintenance only after it accumulates X amount of usage, not after every booking.

Part 1 · Minimum courts

Sort bookings by start time and keep a min-heap of courts keyed by when each frees up. If the earliest-freeing court is available by the next start, reuse it; otherwise open a new court. The heap size never exceeds the peak overlap, which is the optimum.

import java.util.*;

class Scheduler {
    static class Booking { int id, start, finish; Booking(int id,int s,int f){this.id=id;start=s;finish=f;} }

    Map<Integer,Integer> assignCourts(List<Booking> bookings) {
        List<Booking> sorted = new ArrayList<>(bookings);
        sorted.sort(Comparator.comparingInt(b -> b.start));
        PriorityQueue<int[]> courts = new PriorityQueue<>((a,b) -> a[0]-b[0]); // {freeAt, courtIdx}
        Map<Integer,Integer> assignment = new HashMap<>();
        int courtCount = 0;
        for (Booking b : sorted) {
            if (!courts.isEmpty() && courts.peek()[0] <= b.start) {
                int idx = courts.poll()[1];                  // reuse the earliest-free court
                assignment.put(b.id, idx);
                courts.add(new int[]{b.finish, idx});
            } else {
                int idx = courtCount++;                      // open a new court
                assignment.put(b.id, idx);
                courts.add(new int[]{b.finish, idx});
            }
        }
        return assignment;
    }
}

Part 2 · Maintenance after every booking

Each court is busy until its finish time plus X. That is a one-line change: a court frees at finish + X instead of finish. The reuse condition is unchanged.

// inside the loop, when assigning booking b to court idx:
courts.add(new int[]{b.finish + X, idx});   // unavailable during maintenance
// reuse still triggers when courts.peek()[0] <= b.start

Part 3 · Maintenance after accumulated usage

Now a court only needs maintenance once its cumulative busy time crosses a usage limit. Court state grows from a single free-at value to also tracking usage since the last maintenance.

static class Court { int freeAt, idx, usage; Court(int f,int i){freeAt=f;idx=i;} }

Map<Integer,Integer> assignWithUsage(List<Booking> bookings, int usageLimit, int maint) {
    List<Booking> sorted = new ArrayList<>(bookings);
    sorted.sort(Comparator.comparingInt(b -> b.start));
    PriorityQueue<Court> courts = new PriorityQueue<>(Comparator.comparingInt(c -> c.freeAt));
    Map<Integer,Integer> assignment = new HashMap<>();
    int courtCount = 0;
    for (Booking b : sorted) {
        Court c;
        if (!courts.isEmpty() && courts.peek().freeAt <= b.start) c = courts.poll();
        else c = new Court(0, courtCount++);
        assignment.put(b.id, c.idx);
        c.usage += (b.finish - b.start);                 // account this booking's usage
        if (c.usage >= usageLimit) { c.freeAt = b.finish + maint; c.usage = 0; } // maintain + reset
        else c.freeAt = b.finish;
        courts.add(c);
    }
    return assignment;
}

Each part is a small, principled change to the same greedy. The interviewer is watching whether your court abstraction absorbs new rules or whether you restart from scratch.

How Atlassian scores it

Dimension Weak Strong
Core algorithmBrute force or wrong court countSort plus a min-heap keyed by free-at time
Reuse conditionOff-by-one on free vs busyReuse exactly when freeAt <= start
ExtensibilityRewrites for each maintenance ruleExtends court state, keeps the greedy
Usage accountingForgets to reset after maintenanceTracks usage and resets on maintenance
ComplexityUnsure of the costO(n log n) from the sort and heap

This is one question of 14 pages

Get the full Atlassian question bank

The full Atlassian bank carries the coding, low-level design, and values rounds, each problem with its follow-ups and a rubric, compiled from people familiar with the process and cross-verified across sources.

Atlassian interview FAQ

What does the Atlassian coding interview ask?+

Practical scheduling and data-structure problems extended with realistic constraints. The tennis court question is interval partitioning plus maintenance rules; the signal is whether your greedy plus heap generalizes as rules are added.

Is the Atlassian interview LeetCode-style?+

The core patterns overlap (interval scheduling, heaps), but Atlassian leans toward clean, extensible code and clear reasoning about how each new rule changes the state you track.

How is the Atlassian coding round scored?+

On the optimal minimum-courts greedy with a heap, correct reuse conditions, cleanly extending court state for maintenance, complexity, and edge cases like simultaneous bookings.

Where can I find real Atlassian interview questions?+

Pichup maintains a 14-page Atlassian question bank compiled from people familiar with the process, covering the coding, design, and values rounds with follow-ups and rubrics. The question in this guide is one of them.