FastPrepMy Calendar I
Problems/My Calendar I

My Calendar I

Uber logoUber● MediumFULLTIMEONSITE INTERVIEW
QuestionFunctionExamplesConstraints

Problem statement

Source note: The report asked My Calendar I and described it as 99% similar to the LeetCode problem. The judged core task matches the visible source at about 99%; the batch booking interface and examples are specified for practice.

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.

More Uber problems

  • Worst-Performing Ads by CTR in a Campaign TreePHONE SCREEN · Seen Nov 2026
  • Earliest Time All Users Are ConnectedPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • Max Points on a LinePHONE SCREEN · Seen Oct 2026
All Uber interview questionsSee Uber hiring insights
Saved
class Solution {
    public boolean[] bookCalendar(int[] starts, int[] ends) {
      // Write your code here.
    }
}
Checking account…