1 test case wrong

1 test case is wrong

@yashgrover964
send ur code na… then only i will be able to check whats wrong in ur code…

how to provide the code?

how shall i send the code?

Save ur code on Coding Blocks ide ( https://ide.codingblocks.com/ ) and send link

import java.util.*;
public class Main {
public static void main (String args[]) {
Scanner s=new Scanner(System.in);
int n=s.nextInt();
HashMap<Integer,Integer> map=new HashMap<>();
for(int i=0;i<n;i++){
int num=s.nextInt();
if(map.containsKey(num)){
int v=map.get(num);
v++;
map.put(num,v);
}
else{
map.put(num,1);
}
}
int count=0;
Set keys=map.keySet();
for(int i:keys){
int c=map.get(i);
if(c>n/3){
System.out.print(i+" ");
count++;
}
}
if(count==0){
System.out.println(“No Majority Elements”);
}
}
}

plz help me out as only 2nd test case is failing

hi @yashgrover964
i take doubts only in c++. so u can refer my code https://ide.codingblocks.com/s/641967
also when u share ur code save it on ide and then send link… ur code is not compiling only…

actually i have done the same thing as yours but it is showing one case wrong. My code worked perfectly on leetcode’s same problem

hi, there seems some error in compiler that’s why all test cases are not passing… i even tried submitting my code… even it didn’t pass all test case… so don’t worry ur code is correct… u can move ahead… its just complier issue

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.