1 test case failed

import java.util.*;
public class Main {
public static void main (String args[]) {

    Scanner sc= new Scanner(System.in);
    int num= sc.nextInt();
    int x= num/3;

    int arr[]= new int[num];
    for(int i=0; i<num; i++){
        arr[i]= sc.nextInt();
    }

    HashMap<Integer,Integer> hm= new HashMap<>();

    for(int i=0; i<arr.length; i++){
        int count= hm.getOrDefault(arr[i],0);
        hm.put(arr[i],count+1);
    }

    boolean flag=false;
    for(int key: hm.keySet()){
        if(hm.get(key)>x){
            flag=true;
            System.out.print(key+" ");
        }
    }

    if(!flag){
        System.out.print("No Majority Elements");
    }

}

}

hi @ANUKUL1509
refer this https://ide.codingblocks.com/s/648622

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.