@@ -0,0 +1,1076 @@
+import java.util.ArrayList;%0Aimport java.util.Arrays;%0Aimport java.util.Comparator;%0Aimport java.util.List;%0A%0Apublic class _0056MergeIntervals %7B%0A  public int%5B%5D%5B%5D merge(int%5B%5D%5B%5D intervals) %7B%0A    if (intervals.length %3C= 1) %7B%0A      return intervals;%0A    %7D%0A    Arrays.sort(intervals, new Comparator%3Cint%5B%5D%3E()%7B%0A      @Override%0A      public int compare(int%5B%5D arr1, int%5B%5D arr2) %7B%0A        return arr1%5B0%5D - arr2%5B0%5D;%0A      %7D%0A    %7D);%0A    List%3Cint%5B%5D%3E resList = new ArrayList%3C%3E();%0A    int%5B%5D tmp = null;%0A    for (int i = 0; i %3C intervals.length; i++) %7B%0A      int%5B%5D interval = intervals%5Bi%5D;%0A      if (tmp == null) %7B%0A        tmp = interval;%0A      %7D else if (interval%5B0%5D %3C= tmp%5B1%5D) %7B%0A        if (interval%5B1%5D %3E tmp%5B1%5D) %7B%0A          tmp%5B1%5D = interval%5B1%5D;%0A        %7D%0A      %7D else %7B%0A        resList.add(tmp);%0A        tmp = interval;%0A      %7D%0A      if (i == intervals.length - 1) %7B%0A        resList.add(tmp);%0A      %7D%0A    %7D%0A    int%5B%5D%5B%5D res = new int%5BresList.size()%5D%5B2%5D;%0A    for (int i = 0; i %3C resList.size(); i++) %7B%0A      int%5B%5D interval = resList.get(i);%0A      res%5Bi%5D = interval;%0A    %7D%0A    return res;%0A  %7D%0A%7D%0A

Add _0056MergeIntervals