[Solved] How to find occurrence of element more than 2 in Arrays


Write a nested loop to check each element in the array and check it against all the other elements in the array, increment a counter every time you come across the same value. At the end of the inner loop, check if the counter is greater than or equals to 2. If not break the loop.

set counter to 0
Repeat i till end of array{
    Repeat j till end of array{
        check if array[j] == array[i]{
            increment the counter
        }
    }
    check if counter<2{
        break;
    }
}
check if counter<2{
    return false;
}
else{
    return true;
}

1

solved How to find occurrence of element more than 2 in Arrays