@@ -0,0 +1,1838 @@
+package com.cyq7on.greedy;%0A%0Aimport java.util.ArrayList;%0Aimport java.util.Arrays;%0Aimport java.util.List;%0A%0Apublic class IntervalScheduling %7B%0A%0A    public static class Job implements Comparable%3CJob%3E %7B%0A        private String name;%0A        private int startTime;%0A        private int finishTime;%0A%0A        public Job(String name, int startTime, int finishTime) %7B%0A            this.name = name;%0A            this.startTime = startTime;%0A            this.finishTime = finishTime;%0A        %7D%0A%0A        public Job(int startTime, int finishTime) %7B%0A            this(%22%22, startTime, finishTime);%0A        %7D%0A%0A        @Override%0A        public int compareTo(Job o) %7B%0A            return finishTime - o.finishTime;%0A        %7D%0A%0A        @Override%0A        public String toString() %7B%0A            return %22Job%7B%22 +%0A                    %22name='%22 + name + '%5C'' +%0A                    %22, startTime=%22 + startTime +%0A                    %22, finishTime=%22 + finishTime +%0A                    '%7D';%0A        %7D%0A    %7D%0A%0A    public static List%3CJob%3E intervalScheduling(Job%5B%5D jobs) %7B%0A        List%3CJob%3E list = new ArrayList%3C%3E(jobs.length);%0A        Arrays.sort(jobs);%0A        list.add(jobs%5B0%5D);%0A        for (int i = 1; i %3C jobs.length; i++) %7B%0A            Job job = jobs%5Bi%5D;%0A            Job lastJob = list.get(list.size() - 1);%0A            if (job.startTime %3E= lastJob.finishTime) %7B%0A                list.add(job);%0A            %7D%0A        %7D%0A        return list;%0A    %7D%0A%0A    public static void main(String%5B%5D args) %7B%0A        Job%5B%5D jobs = %7B%0A                new Job(%22a%22, 0, 6),%0A                new Job(%22b%22, 1, 4),%0A                new Job(%22c%22, 3, 5),%0A                new Job(%22d%22, 3, 8),%0A                new Job(%22e%22, 4, 7),%0A                new Job(%22f%22, 5, 9),%0A                new Job(%22g%22, 6, 10),%0A                new Job(%22h%22, 8, 11),%0A        %7D;%0A        System.out.println(intervalScheduling(jobs));%0A    %7D%0A%7D%0A

Add interval scheduling