Write Tests That Expose a Buggy Reservation Overlap Check

Last updated: November 29, 2026

Quick Overview

A colleague's function decides whether two meeting-room or lab-equipment reservations overlap, and users report double bookings; write tests that expose the bug, then fix the function.

IBM
Software Engineering Fundamentals
Software Engineer
IBM
November 29, 2026
Software Engineer
Phone Screen
Software Engineering Fundamentals
Easy

0

0

0 solved


A colleague's function decides whether two meeting-room or lab-equipment reservations overlap, and users report double bookings; write tests that expose the bug, then fix the function.

IBM Maximo and internal booking tools manage reservations of assets, and a quick debugging and testing exercise like this appears in IBM phone screens for early-career engineers. The interviewer looks for systematic test case design around boundaries rather than random examples.

What the Interviewer Expects
  • Enumerate interval relationships: before, after, touching, partial, containment, identical
  • Find the failing case quickly with tests
  • Fix with the canonical overlap condition
  • State the half-open convention
  • Keep tests small and readable
Key Topics to Cover
unit testing
boundary values
debugging
interval overlap
How to Approach This
  1. Apply SOLID principles. Single Responsibility makes code testable, Open/Closed makes it extensible.
  2. Choose data structures based on access patterns, not familiarity.
  3. Prefer immutable data and message passing over shared mutable state for concurrency.
  4. Design APIs with RESTful conventions, versioning, meaningful errors, and pagination from day one.
Possible Follow-up Questions
  • How would you use property-based testing here?
  • What if reservations can span midnight or time zones?
  • How would you enforce no-overlap at the database level?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice System Design Problems
Sample Answer
Requirements

Reservations are half-open [start, end): one ending at 10:00 and another starting at 10:00 do not conflict. The buggy code is:

def overlaps(a_start, a_end, b_start, b_end): return a_s...
High-Level Design

Rather than guess, list the six relationships of two intervals and write one test per case: A before B, A after B, touching at a boundary, partial overlap with A first, partial overlap with B first, a...


Submit Your Answer
Markdown supported