package leetcode;

/**
 * https://leetcode.com/problems/remove-covered-intervals/
 */
public class Problem1288 {
    public int removeCoveredIntervals(int[][] intervals) {
        // TODO
        return 0;
    }

    public static void main(String[] args) {
        Problem1288 prob = new Problem1288();
        System.out.println(prob.removeCoveredIntervals(new int[][]{{1,4},{3,6},{2,8}})); // 2
    }
}

@@ -12,16 +12,65 @@
 tcode;%0A%0A
+import java.util.HashSet;%0Aimport java.util.Set;%0A%0A
 /**%0A * h
@@ -226,225 +226,746 @@
     
-// TODO%0A        return 0;%0A    %7D%0A%0A    public static void main(String%5B%5D args) %7B%0A        Problem1288 prob = new Problem1288();%0A        System.out.println(prob.removeCoveredIntervals(new int%5B%5D%5B%5D%7B%7B1,4%7D,%7B3,6%7D,%7B2,8%7D%7D)); // 2
+Set%3CInteger%3E removed = new HashSet%3C%3E();%0A        for (int i = 0; i %3C intervals.length; i++) %7B%0A            if (removed.contains(i)) %7B%0A                continue;%0A            %7D%0A            for (int j = i + 1; j %3C intervals.length; j++) %7B%0A                if (removed.contains(j)) %7B%0A                    continue;%0A                %7D%0A                int a = intervals%5Bi%5D%5B0%5D;%0A                int b = intervals%5Bi%5D%5B1%5D;%0A                int c = intervals%5Bj%5D%5B0%5D;%0A                int d = intervals%5Bj%5D%5B1%5D;%0A                if (c %3C= a && b %3C= d) %7B%0A                    removed.add(i);%0A                %7D else if (a %3C= c && d %3C= b) %7B%0A                    removed.add(j);%0A                %7D%0A            %7D%0A        %7D%0A        return intervals.length - removed.size();
 %0A   

Solve problem 1288