I am trying to loop through my array and find all the numbers that are repeating more than once:
E.G: if there is 1 1 2 3 4
1 1 2 3 4
It should print saying \
Just add the number you will find duplicated to some structure like HashSet or HashMap so you can find it later when you will detect another duplication.
HashSet
HashMap
Set printed = new HashSet(); for(int i=0; i
Better O(n) alghorithm: