Question: / * * * Check if some number ( 1 ~ 9 ) appears more than once in the array. * * A possible algorithm:
Check if some number ~ appears more than once in the array.
A possible algorithm:
Create a boolean array of nine elements, each element corresponding to one number.
Loop through the input array arr, if the corresponding position of a number
in the boolean array is false, mark it as true.
If the position of a number is already true, return false duplicate number found
@param arr A d array that needs to be checked
@return true if no conflict; false otherwise, and when arr is null.
public static boolean checkConflictForArrayint arr
return false;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
