Leetcode 436. Find Right Interval
- Type: Binary search
- Approach:
- Find the right relationship for each interval by binary search
- Sort the original intervals array by start time.
- Use a new array to store all start times.
- For each interval, find the start time in sorted start times which is the end time of the interval we focus by binary search.
- Find the right relationship for each interval by binary search
- Complexity:
- Time: O(nlogn)
- Space: O(n)