PracHub
QuestionsCoachesLearningGuidesInterview Prep

Quick Overview

This question evaluates interval scheduling and resource-allocation competencies, testing algorithmic and data-structure knowledge for handling time-interval conflicts and producing a minimal concurrent-resource assignment.

  • medium
  • Atlassian
  • Coding & Algorithms
  • Machine Learning Engineer

Assign bookings to minimum tennis courts

Company: Atlassian

Role: Machine Learning Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Onsite

You are given a list of tennis court bookings. Each booking has a **start** time and an **end** time. ## Task Return an assignment plan that: 1. Assigns **each booking** to a specific court (e.g., court IDs `1..k`). 2. Ensures **no court has overlapping bookings**. 3. Uses the **minimum number of courts** (assume unlimited courts are available). You may return: - The **minimum number of courts** needed, and - An **array of court IDs** aligned with the input bookings (i.e., `assignment[i]` is the court used by booking `i`). ## Follow-up: Maintenance buffer After a booking ends, the court is unavailable for a fixed **maintenance time** `M` (e.g., minutes). That means a booking `[s2, e2]` can reuse the same court after booking `[s1, e1]` only if: - `s2 >= e1 + M` Update your approach to support this requirement. ## Notes / Assumptions - Time can be treated as integers. - You should aim for an efficient solution (e.g., for large `n`).

Quick Answer: This question evaluates interval scheduling and resource-allocation competencies, testing algorithmic and data-structure knowledge for handling time-interval conflicts and producing a minimal concurrent-resource assignment.

Assign each booking to the smallest available court id with optional maintenance buffer. Return court count and assignment aligned to input.

Constraints

  • Inputs are Python literals matching the function signature.
  • Return a deterministic exact-match value.

Examples

Input: ([[0,30],[5,10],[15,20]], 0)

Expected Output: {'courts': 2, 'assignment': [1, 2, 2]}

Explanation: Two courts.

Input: ([[0,10],[10,20]], 0)

Expected Output: {'courts': 1, 'assignment': [1, 1]}

Explanation: Reuse without buffer.

Input: ([[0,10],[10,20]], 5)

Expected Output: {'courts': 2, 'assignment': [1, 2]}

Explanation: Buffer requires another court.

Hints

  1. Use deterministic tie-breaking for prompts with multiple valid outputs.
  2. For design-style APIs, simulate operations with explicit inputs.
Last updated: Jun 27, 2026

Loading coding console...

PracHub

Master your tech interviews with 8,000+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • AI Coding Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.

Related Coding Questions

  • Find a secret word using match feedback - Atlassian (hard)
  • Compute a moving average on a stream - Atlassian (hard)
  • Implement sliding-window rate limiter function - Atlassian (medium)
  • Implement sequential and parallel URL requests - Atlassian (medium)
  • Merge intervals and design rating APIs - Atlassian (medium)