Question: / * * * Check if some number ( 1 ~ 9 ) appears more than once in the array. * * A possible algorithm:

/**
* Check if some number (1~9) appears more than once in the array.
*
* A possible algorithm:
*1. Create a boolean array of nine elements, each element corresponding to one number.
*2. Loop through the input array arr, if the corresponding position of a number
* in the boolean array is false, mark it as true.
*3. If the position of a number is already true, return false (duplicate number found).
*
* @param arr A 1d array that needs to be checked
* @return true if no conflict; false otherwise, and when arr is null.
*/
public static boolean checkConflictForArray(int[] arr){
return false;
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!