add solution for hw3:3637 & tests in runner
This commit is contained in:
@@ -19,4 +19,4 @@ jobs:
|
|||||||
|
|
||||||
- name: Run Sum tests
|
- name: Run Sum tests
|
||||||
run: |
|
run: |
|
||||||
java -ea -cp out reverse.ReverseTest Base 3233 3435
|
java -ea -cp out reverse.ReverseTest Base 3233 3435 3637
|
||||||
|
|||||||
@@ -30,15 +30,32 @@ public class ReverseMaxC {
|
|||||||
lines[linesCount++] = line;
|
lines[linesCount++] = line;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PrintWriter out = getPrintWriter(linesCount, lines);
|
||||||
|
out.flush();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static PrintWriter getPrintWriter(int linesCount, int[][] lines) {
|
||||||
PrintWriter out = new PrintWriter(System.out);
|
PrintWriter out = new PrintWriter(System.out);
|
||||||
for (int i = linesCount - 1; i >= 0; i--) {
|
|
||||||
|
for (int i = 0; i < linesCount; i++) {
|
||||||
int[] line = lines[i];
|
int[] line = lines[i];
|
||||||
for (int j = line.length - 1; j >= 0; j--) {
|
|
||||||
if (j < line.length - 1) out.print(" ");
|
for (int j = 0; j < line.length; j++) {
|
||||||
out.print(line[j]);
|
|
||||||
|
if (j > 0) out.print(" ");
|
||||||
|
|
||||||
|
int maxRow = lines[i][j];
|
||||||
|
|
||||||
|
for (int k = i + 1; k < linesCount; k++) {
|
||||||
|
if (lines[k].length > j && lines[k][j] > maxRow) {
|
||||||
|
maxRow = lines[k][j];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
out.print(maxRow);
|
||||||
}
|
}
|
||||||
out.println();
|
out.println();
|
||||||
}
|
}
|
||||||
out.flush();
|
return out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user