package leetcode;

/**
 * https://leetcode.com/problems/find-right-interval/
 */
public class Problem436 {
    public static class Interval {
        int start;
        int end;

        Interval() {
            start = 0;
            end = 0;
        }

        Interval(int s, int e) {
            start = s;
            end = e;
        }
    }

    public int[] findRightInterval(Interval[] intervals) {
        // TODO
        return new int[0];
    }

    public static void main(String[] args) {
        Problem436 prob = new Problem436();
        System.out.println(prob.findRightInterval(new Interval[]{new Interval(1, 2)})); // [-1]
        System.out.println(prob.findRightInterval(new Interval[]{
            new Interval(3, 4),
            new Interval(2, 3),
            new Interval(1, 2)
        })); // [-1, 0, 1]
        System.out.println(prob.findRightInterval(new Interval[]{
            new Interval(1, 4),
            new Interval(2, 3),
            new Interval(3, 4)
        })); // [-1, 2, -1]
        System.out.println(prob.findRightInterval(new Interval[]{
            new Interval(4, 8),
            new Interval(3, 4),
            new Interval(1, 4)
        })); // [-1, 0, 0]
    }
}

@@ -12,16 +12,42 @@
 tcode;%0A%0A
+import java.util.Arrays;%0A%0A
 /**%0A * h
@@ -585,32 +585,48 @@
 tem.out.println(
+Arrays.toString(
 prob.findRightIn
@@ -668,16 +668,17 @@
 1, 2)%7D))
+)
 ; // %5B-1
@@ -698,32 +698,48 @@
 tem.out.println(
+Arrays.toString(
 prob.findRightIn
@@ -859,32 +859,33 @@
 , 2)%0A        %7D))
+)
 ; // %5B-1, 0, 1%5D%0A
@@ -903,32 +903,48 @@
 tem.out.println(
+Arrays.toString(
 prob.findRightIn
@@ -1064,32 +1064,33 @@
 , 4)%0A        %7D))
+)
 ; // %5B-1, 2, -1%5D
@@ -1117,16 +1117,32 @@
 println(
+Arrays.toString(
 prob.fin
@@ -1278,16 +1278,17 @@
      %7D))
+)
 ; // %5B-1
@@ -1295,16 +1295,222 @@
 , 0, 0%5D%0A
+        System.out.println(Arrays.toString(prob.findRightInterval(new Interval%5B%5D%7B%0A            new Interval(1, 2),%0A            new Interval(3, 5),%0A            new Interval(4, 5)%0A        %7D))); // %5B1, -1, -1%5D%0A
     %7D%0A%7D%0A

Update problem 436