Get best answers to any doubt/query/question related to programming , jobs, gate, internships and tech-companies. Feel free to ask a question and you will receive the best advice/suggestion related to anything you ask about software-engineering , development and programming problems .

0 like 0 dislike
1,170 views

For proper oa or interview experiences list of all top tech companies visit :

https://oa.desiqna.in

https://interview.desiqna.in

 

in Online Assessments by Expert (44,360 points)
retagged by

1 Answer

0 like 0 dislike

Online Assessment Question :

image

 

image

 

image


 

by Expert (44,360 points)
0 0
private static int countDuplicates(int arr[]){
     HashMap<Integer,Integer> map = new HashMap<>();
     
     for(int num:arr){
         map.put(num,map.getOrDefault(num,0) + 1);
     }
     int count = 0;
     for(Map.Entry<Integer,Integer> m:map.entrySet()){
         if(m.getValue() > 1) count++;
     }
     
     return count;
 }
}
...