Here's my nonworking code:
Code:
int count = 0;
int prevCount = 0;
int totalCount = 0;
for (int i = 0; i <array.length; i++){
for (int j = i + 1; j < array.length; j++){
if (array[i] == array[j]){
count++;
i++;
}
}
if (count >= prevCount){
totalCount++;
}
prevCount = count;
count = 0;
}
Comment