int count = 0;
for (int i = 0; i < arr.length; i++) {
for (int j = 0; j < arr.length; j++) {
if (arr[i] == arr[j] && i != j) {
return false;
}else count++;
}
} return (count == 3);
Task: Given an integer denoting the size of the array.Fill array with integers and return true if array contains duplicate 3 times next to each other. This code does not Works fine. Given true if found duplicates 2 times.I need three times,and next to each other!! Some1 could help me please?!
countif either the indices are the same or the values are not. What do you thinkcountwould express in that case?