how would I go about checking a duplicate for columns and rows and return true or false depending if there's duplicates. For example
1 2 3
3 1 2
2 3 1
Would return true because no duplicates, but..
1 2 2
3 2 3
2 1 1
would return false because there is a duplicate in column 2 {2, 2, 1}.
How would I go about checking for if there are in duplicates in the rows and then checking if there are duplicates in the columns?
So far I have only the following:
public static boolean hasDuplicates(int [][] inArray)
{
for (int row = 0; row < inArray.length; row++)
{
int rowCheck = inArray[row][inArray.length];
for (int col = 0; col < inArray[row].length; col++)
{
}
}
return false;
}
So I need to take in an array and check if there are any duplicates among the columns or rows. Any pointers? Thank you!
NOTE: This cannot be done with outside methods