Logo
Grokking the Coding Interview: Patterns for Coding Questions
Ask Author
Back to course home

0% completed

Solution: My Calendar I

Problem Statement

Given a 2D array nums of size N x 2.

  • nums[i] = [start<sub>i</sub>, end<sub>i</sub>], where start<sub>i</sub> is the starting time of the event and end<sub>i</sub> is the ending time of the event.

For each nums[i], determine if a requested booking time conflicts with any existing bookings.

Return a boolean array of size N, representing whether the booking can be done in the given time interval.

Examples

  1. Example 1:
    • Input: nums = [[10, 20], [15, 25], [20, 30]]
    • Expected Output: [true, false, true]

.....

.....

.....

Like the course? Get enrolled and start learning!