25 lines
426 B
Java
25 lines
426 B
Java
/**
|
|
*
|
|
* Alone
|
|
*/
|
|
public class Alone {
|
|
|
|
public static void main(String[] args) {
|
|
int[] arr = { 1, 1, 1, 3, 4, 4, 5, 5, 5, 5 };
|
|
System.out.println(lonelyNum(arr));
|
|
}
|
|
|
|
public static int lonelyNum(int[] nums) {
|
|
int count = 0;
|
|
nums[0] = 0;
|
|
for (int x : nums) {
|
|
for (int i = 0; i < nums.length; i++) {
|
|
if (x != nums[i]) {
|
|
count++;
|
|
}
|
|
}
|
|
}
|
|
return count;
|
|
}
|
|
}
|