My Calendar I
Reported by candidates from Uber's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.
Uber reported this one in September 2026, and the trap is one character: the interval is half-open. If you write start <= end instead of start < end, your solution fails the touching-endpoint case in Example 1 and you won't know why. It's My Calendar I dressed up as a function that takes two arrays. The core is an interval overlap check against everything already accepted. With up to 1000 bookings, a simple scan works fine. If you blank on the boundary logic mid-assessment, StealthCoder runs invisibly as a safety net and gives you the working check in real time.
The problem
You are implementing a calendar that stores booked half-open intervals [start, end). You are given two integer arrays starts and ends of the same length. The i-th booking attempt requests the interval [starts[i], ends[i]). Accept the booking if and only if it does not overlap any already accepted interval. Adjacent bookings that only touch at an endpoint do not overlap because the end time is exclusive. Return a boolean array where entry i is true when the i-th attempt is accepted. Function bookCalendar(starts: int[], ends: int[]) → boolean[] Examples Example 1 starts = [10,15,20] ends = [20,25,30] return = [true,false,true] The first booking [10, 20) is accepted. The second booking [15, 25) overlaps it and is rejected. The third booking [20, 30) only touches the accepted interval at time 20, so it is accepted. Example 2 starts = [47,33,36,25,24] ends = [50,41,45,32,33] return = [true,true,false,true,false] [47, 50), [33, 41), and [25, 32) are disjoint and accepted. [36, 45) overlaps [33, 41), and [24, 33) overlaps [25, 32). Constraints 1 <= starts.length <= 1000. ends.length == starts.length. 0 <= starts[i] < ends[i] <= 10^9.
Reported by candidates. Source: FastPrep
Pattern and pitfall
The trick is the overlap test. Two half-open intervals [a, b) and [c, d) overlap exactly when a < d and c < b. Anything else is disjoint, including the case where b == c. Keep a list of accepted pairs. For each attempt, loop over the list, and if any pair overlaps, push false. Otherwise add it and push true. That's O(n^2), which is fine at n = 1000. The common pitfall is using <= and rejecting adjacent bookings, which breaks Example 1's third booking. The other is mutating the accepted list on a rejected booking. A sorted structure with binary search gets you O(n log n), but you don't need it here. If the boundary logic slips under pressure, StealthCoder is the hedge on the live OA. It reads the problem and hands you the strict-inequality check so you can keep moving.
The honest play: practice the pattern, and have StealthCoder ready for the one you didn't see coming.
You can drill My Calendar I cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. Built for the candidate who saw this exact problem leak two days before his OA and wondered if anyone had a play.
Get StealthCoderRelated leaked OAs
This OA pattern shows up on LeetCode as my calendar i. If you have time before the OA, drill that.
You've seen the question.
Make sure you actually pass Uber's OA.
Uber reuses patterns across OAs. Built for the candidate who saw this exact problem leak two days before his OA and wondered if anyone had a play. Works on HackerRank, CodeSignal, CoderPad, and Karat.
My Calendar I FAQ
How hard is the Uber My Calendar I question really?+
Easy. It's one overlap condition and a loop. The difficulty is the half-open boundary, not the algorithm. Most failed attempts come from using <= instead of <, which wrongly rejects bookings that only touch at an endpoint.
What's the trick to the overlap check?+
Two intervals [a, b) and [c, d) overlap when a < d and c < b. Both comparisons are strict. That one line handles touching endpoints correctly, so [10, 20) and [20, 30) are accepted together.
Is brute force fast enough with 1000 bookings?+
Yes. Checking each new booking against every accepted one is O(n^2), about a million comparisons at most. That's fine for n up to 1000. Only reach for a sorted structure if you want to show off.
Do rejected bookings get stored?+
No. Only accepted intervals go in the list. If you store a rejected one, later bookings get blocked by an interval that was never on the calendar, and your output diverges from Example 2.
How do I prepare for this in 48 hours?+
Write the overlap check from memory, then run both examples by hand, especially the touching case. Then do a couple of other interval problems like merge intervals to get the boundary reasoning automatic.