@@ -0,0 +1,1515 @@
+/**%0A * Definition for an interval.%0A * public class Interval %7B%0A *     int start;%0A *     int end;%0A *     Interval() %7B start = 0; end = 0; %7D%0A *     Interval(int s, int e) %7B start = s; end = e; %7D%0A * %7D%0A */%0Apublic class Solution %7B%0A    public List%3CInterval%3E merge(List%3CInterval%3E intervals) %7B%0A        List%3CInterval%3E result = new ArrayList%3CInterval%3E();%0A        boolean%5B%5D alreadyAdd = new boolean%5Bintervals.size()%5D;%0A        %0A        intervals.sort((i1, i2) -%3E Integer.compare(i1.start, i2.start));%0A        %0A        for(int i = 0; i %3C intervals.size(); ++i) %7B%0A            if(alreadyAdd%5Bi%5D)%0A                continue;%0A            %0A            alreadyAdd%5Bi%5D = true;%0A            Interval toAdd = new Interval(intervals.get(i).start, intervals.get(i).end);%0A            for(int j = i + 1; j %3C intervals.size(); ++j) %7B%0A                if(alreadyAdd%5Bj%5D)%0A                    continue;%0A                %0A                // if overlapping%0A                if((toAdd.start %3E= intervals.get(j).start && toAdd.start %3C= intervals.get(j).end) %7C%7C%0A                   (toAdd.end %3C= intervals.get(j).end && toAdd.end %3E= intervals.get(j).start) %7C%7C%0A                   (toAdd.start %3C= intervals.get(j).start && toAdd.end %3E= intervals.get(j).end)) %7B%0A                    toAdd.start = Math.min(toAdd.start, intervals.get(j).start);%0A                    toAdd.end = Math.max(toAdd.end, intervals.get(j).end);%0A                    alreadyAdd%5Bj%5D = true;%0A                %7D%0A            %7D%0A            result.add(toAdd);%0A        %7D%0A        return result;%0A    %7D%0A%7D%0A

Create MergeIntervals.java