ArrayTester - Part B¶
Part b. Write the static method
isLatin, which returns
true if a given two-dimensional square array is a
Latin square, and otherwise, returns false.
A two-dimensional square array of integers is a Latin square if the following conditions are true. 1) The first row has no duplicate values. 2) All values in the first row of the square appear in each row of the square. 3) All values in the first row of the square appear in each column of the square.
ArrayTester class provides two helper methods:
hasAllValues. The method
true if the given one-dimensional array
arr contains any duplicate values and
false otherwise. The method
true if and only if every value in
arr1 appears in
arr2. You do not need to write the code for these methods.
isLatin below. Assume that
getColumn works as specified, regardless of what
you wrote in part (a). You must use
appropriately to receive full credit.
Try and Solve It¶
Complete the method