@@ -0,0 +1,2740 @@
+package year2017;%0A%0Aimport java.util.ArrayList;%0Aimport java.util.List;%0A%0A/**%0A * %3Ch3%3EMaximal Layers%3C/h3%3E%0A * %3Cp%3EConsider a group of points. Each point is made of an x and y coordinate.%0A * A point from that group is considered maximal if there is%0A * no other point in the group that is %22north%22 and %22east%22 of it.%3C/p%3E%0A *%0A * @author John Cameron%0A * @see %3Ca href=%22https://www.seminolestate.edu/computers/competition/samples/2017%22%3EProblem Descrption and Requirements%3C/a%3E%0A */%0Apublic class MaximalLayers %7B%0A%0A    public static void main(String%5B%5D args) %7B%0A%0A        List%3CCoordinate%3E coordinates = new ArrayList%3C%3E();%0A%0A        //Read from text file (use FileInputStream for real files)%0A        /*Scanner scanner = new Scanner(MaximalLayers.class.getResourceAsStream(%22/maximal.txt%22));%0A%0A%09%09while (scanner.hasNextInt())%0A%09%09%09coordinates.add(new Coordinate(scanner.nextInt(), scanner.nextInt()));%0A%0A%09%09scanner.close();*/%0A%0A        //Test data set 1%0A        /*coordinates.addAll(Arrays.asList(%0A%09%09%09%09new Coordinate(5, 5),%0A%09%09%09%09new Coordinate(4, 9),%0A%09%09%09%09new Coordinate(10, 2),%0A%09%09%09%09new Coordinate(2, 3),%0A%09%09%09%09new Coordinate(15, 7)%0A%09%09));*/%0A%0A        int layer = 1;%0A%0A        while (!coordinates.isEmpty()) %7B%0A%0A            System.out.print(%22Layer %22 + layer + %22: %22);%0A            layer++;%0A%0A            List%3CCoordinate%3E maximalCoordinateOrder = new ArrayList%3C%3E();%0A%0A            for (Coordinate c : coordinates) %7B%0A%0A                boolean foundMoreNorth = false;%0A                boolean foundMoreEast = false;%0A%0A                for (Coordinate o : coordinates) %7B%0A%0A                    if (o.equals(c))%0A                        continue;%0A%0A                    if (o.x %3E c.x)%0A                        foundMoreNorth = true;%0A%0A                    if (o.y %3E c.y)%0A                        foundMoreEast = true;%0A%0A                %7D%0A%0A                if (!foundMoreNorth %7C%7C !foundMoreEast) %7B%0A%0A                    System.out.print(c.toString() + %22 %22);%0A                    maximalCoordinateOrder.add(c);%0A%0A                %7D%0A%0A            %7D%0A%0A            coordinates.removeAll(maximalCoordinateOrder);%0A%0A            System.out.println();%0A%0A        %7D%0A%0A%0A    %7D%0A%0A%7D%0A%0Aclass Coordinate %7B%0A%0A    public final int x, y;%0A%0A    Coordinate(int x, int y) %7B%0A        this.x = x;%0A        this.y = y;%0A    %7D%0A%0A    @Override%0A    public boolean equals(Object o) %7B%0A        if (this == o) %7B%0A            return true;%0A        %7D else if (o instanceof Coordinate) %7B%0A            Coordinate that = (Coordinate) o;%0A%0A            return x == that.x && y == that.y;%0A        %7D else %7B%0A            return false;%0A        %7D%0A    %7D%0A%0A    @Override%0A    public String toString() %7B%0A        return this.x + %22,%22 + this.y;%0A    %7D%0A%0A    @Override%0A    public int hashCode() %7B%0A        int result = x;%0A        result = 31 * result + y;%0A        return result;%0A    %7D%0A%7D

Add Maximal Layers (2017) solution