Loading...
You are given an integer k and a list slots. There are k people, numbered from 0 to k - 1. Each element in slots contains [person, start, end] meaning that person is free from time start to time end.
Every person appears in at least one slot. A person may have several slots, and a person's slots may overlap.
Return true if some period of positive length lies entirely inside at least one slot of every person. Otherwise, return false.
Note that two slots that only touch at a single time, such as [0, 5] and [5, 9], share no period of positive length.
Input: k = 2, slots = [[0, 20, 25], [0, 0, 10], [1, 10, 20], [1, 25, 30]]
Output: false
Explanation: Person 0 is free during [0, 10] and [20, 25]. Person 1 is free during [10, 20] and [25, 30]. Their slots only touch at times 10, 20, and 25.
Input: k = 2, slots = [[0, 0, 10], [0, 20, 25], [1, 30, 35], [1, 5, 15]]
Output: true
Explanation: Both people are free during [5, 10].
Input: k = 3, slots = [[0, 0, 15], [0, 20, 25], [1, 30, 35], [1, 5, 15], [2, 0, 5], [2, 10, 20], [2, 25, 30]]
Output: true
Explanation: All three people are free during [10, 15].
k ≤1000k ≤ slots.length ≤105person < kstart < end ≤1090 to k - 1 appears in at least one slot