Add files via upload

This commit is contained in:
Aesthetiful authored and GitHub committed 2024-03-21 11:45:04 -07:00
1 parent a522d70e6d
commit a09f45a2a4
5 files changed
+132 -11

No files matched your search

+26
View File
@@ -0,0 +1,26 @@
public class RowCompare
{
public static boolean isRow(int[] arr, int[][] mat, int limit) {
if (limit < 0 || limit > mat.length) {
return false;
}
for (int i = 0; i < limit; i++) {
if (mat[i].length == arr.length) {
boolean rowMatch = true;
for (int j = 0; j < arr.length; j++) {
if (mat[i][j] != arr[j]) {
rowMatch = false;
break;
}
}
if (rowMatch) {
return true;
}
}
}
return false;
}
}
+22
View File
@@ -0,0 +1,22 @@
public class RowCompare
{
public static int uniqueRows(int[][] mat) {
int uniqueCount = 0;
for (int i = 0; i < mat.length; i++) {
if (!isRow(mat[i], mat, i)) {
uniqueCount++;
}
}
return uniqueCount;
}
public static boolean isRow(int[] arr, int[][] mat, int limit)
{
/* COMPLETE WORKING METHOD PROVIDED */
/* DO NOT MODIFY THE IMPLEMENTATION OF THIS METHOD*/
return testing.FRQFunctions.isRow(arr, mat, limit);
}
}