Back to problems

Design a Calendar Booking System

Object-Oriented Programming · Robinhood · Medium

1. Linear Scan over Stored Intervals The most direct approach maintains an ordinary list of every accepted booking. When a new request [start, end) arrives, we iterate through the list and check each stored interval for overlap. Two intervals [a, b) and [c, d) share time exactly when a < d and c < b. Because both ends are exclusive, touching at a single point—for instance b == c—does not count as overlap. If any stored interval satisfies both inequalities, the request is…

Checking your access…