Untitled

mail@pastecode.io avatar
unknown
java
2 years ago
249 B
3
Indexable
Never
public static int countReps(int a[]) {
  int teljari = 0;
  Arrays.sort(a);
  for (int i = 0; i < a.length; i++) {
      for (int j = 0; j < i; j++) {
          if (a[i] == a[j]) {
              teljari++;
          }
      }
  }
  return teljari;
}