|
7 | 7 | import java.util.HashMap;
|
8 | 8 | import java.util.Map;
|
9 | 9 |
|
10 |
| -/**436. Find Right Interval |
11 |
| - * |
12 |
| - * Given a set of intervals, for each of the interval i, check if there exists an interval j whose start |
13 |
| - * point is bigger than or equal to the end point of the interval i, which can be called that j is on the "right" of i. |
14 |
| - * |
15 |
| - * For any interval i, you need to store the minimum interval j's index, |
16 |
| - * which means that the interval j has the minimum start point to build the "right" relationship for interval i. |
17 |
| - * If the interval j doesn't exist, store -1 for the interval i. Finally, you need output the stored value of each interval as an array. |
18 |
| - * |
19 |
| - * Note: |
20 |
| - * |
21 |
| - * You may assume the interval's end point is always bigger than its start point. |
22 |
| - * You may assume none of these intervals have the same start point. |
23 |
| - * |
24 |
| - * Example 1: |
25 |
| - * Input: [ [1,2] ] |
26 |
| - * Output: [-1] |
27 |
| - * Explanation: There is only one interval in the collection, so it outputs -1. |
28 |
| - * |
29 |
| - * Example 2: |
30 |
| - * Input: [ [3,4], [2,3], [1,2] ] |
31 |
| - * Output: [-1, 0, 1] |
32 |
| - * Explanation: There is no satisfied "right" interval for [3,4]. |
33 |
| - * For [2,3], the interval [3,4] has minimum-"right" start point; |
34 |
| - * For [1,2], the interval [2,3] has minimum-"right" start point. |
35 |
| - * |
36 |
| - * Example 3: |
37 |
| - * Input: [ [1,4], [2,3], [3,4] ] |
38 |
| - * Output: [-1, 2, -1] |
39 |
| - * Explanation: There is no satisfied "right" interval for [1,4] and [3,4]. |
40 |
| - * For [2,3], the interval [3,4] has minimum-"right" start point. |
41 |
| - * */ |
42 |
| - |
43 | 10 | public class _436 {
|
44 | 11 |
|
45 | 12 | public static class Solution1 {
|
|
0 commit comments