-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDay78.java
More file actions
29 lines (29 loc) · 730 Bytes
/
Copy pathDay78.java
File metadata and controls
29 lines (29 loc) · 730 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import java.util.*;
public class Day78{
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int out[] = new int[in.nextInt()];
for (int j=0;j<out.length ;j++ ) {
int arr[] = new int[in.nextInt()];
int max = Integer.MIN_VALUE,count = 1,value = 0;
for (int i=0;i<arr.length ;i++ ) {
arr[i] = in.nextInt();
}
for (int i=0;i<arr.length ;i++ ) {
count = 1;
value = arr[i];
for (int k=i+1;k<arr.length ;k++ ) {
if (value==arr[k]) {
count++;
}
}
max = Math.max(max, count);
}
out[j] = arr.length - max;
}
System.out.println("Output");
for (int i=0;i<out.length ;i++ ) {
System.out.println(out[i]);
}
}
}