Popcorn hack 1
int[][] scores = {
{100, 85, 95, 96},
{98, 100, 100, 95},
{92, 100, 98, 100},
{100, 100, 97, 99},
{100, 100, 100, 70},
{100, 100, 99, 98},
{100, 94, 100, 93}
};
int score1 = scores[2][0];
int score2 = scores[4][3];
int score3 = scores[6][3];
System.out.println(score1);
System.out.println(score2);
System.out.println(score3);
scores[6][3] = 100;
int score3 = scores[6][3];
System.out.println(score3);
92
70
93
100
HW Latin Square
int[][] square = {
{1, 3, 2},
{2, 1, 3},
{3, 2, 1}
};
public static boolean isLatin(int[][] square) {
int n = square.length;
for (int row = 0; row < n; row++) {
boolean[] seen = new boolean[n + 1];
for (int col = 0; col < n; col++) {
int value = square[row][col];
if (value < 1 || value > n || seen[value]) {
return false;
}
seen[value] = true;
}
}
for (int col = 0; col < n; col++) {
boolean[] seen = new boolean[n + 1];
for (int row = 0; row < n; row++) {
int value = square[row][col];
if (value < 1 || value > n || seen[value]) {
return false;
}
seen[value] = true;
}
}
return true;
}
System.out.println(isLatin(square));
true