Help me in solving EQUALELE problem

My issue

its givimg runtime error…i have solved this using maps…and similar approach for array is taken i.e by counting the max no of element…and sub from the total. sp is there any way to solve it by using the array aproach i used.

My code

/* package codechef; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Codechef
{
	public static void main (String[] args) throws java.lang.Exception
	{
	    	Scanner sc= new Scanner(System.in);
		int x= sc.nextInt();
		for(int i=0;i<x;i++){
		    int y= sc.nextInt();
		   int[] arr= new int[1000];
	int max=0;
		    for(int j=0;j<y;j++){
		        int input= sc.nextInt();
		       arr[input]++;
		       if(arr[input]>max){
		           max=arr[input];
		       }
		       
		    }
		    
		    int h= y-max;
		    System.out.println(h);
		}
	
	}
}

Learning course: Arrays, Strings & Sorting
Problem Link: CodeChef: Practical coding for everyone

@swagger28
array elements is upto 200000.
So take array of size 200001 to avoid run time error .
I have corrected it in your code.

/* package codechef; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Codechef
{
	public static void main (String[] args) throws java.lang.Exception
	{
	    	Scanner sc= new Scanner(System.in);
		int x= sc.nextInt();
		for(int i=0;i<x;i++){
		    int y= sc.nextInt();
		   int[] arr= new int[200001];
	int max=0;
		    for(int j=0;j<y;j++){
		        int input= sc.nextInt();
		       arr[input]++;
		       if(arr[input]>max){
		           max=arr[input];
		       }
		       
		    }
		    
		    int h= y-max;
		    System.out.println(h);
		}
	
	}
}

thanks a lot brother!