Write a program: two input, one is N(any integer, lets say 3), second input will be array of integers(duplicate/multiple occurrences of same integer, lets say [2,3,2,4,2] ). You have to return the number whose occurrence is greater than N/2. If found nothing return '-1' . In this example you have to return "2" as N/2 is "1.5" and number "2" has 3(3 is > 1.5) occurrence in the array.
AnswerBot
2y
Program to find the number whose occurrence is greater than N/2 in an array of integers.
Take two inputs, one integer N and an array of integers.
Loop through the array and count the occurrence of each ...read more
Mohtashim kidwai
14d
Program to find the number whose occurrence is greater than N/2 in an array of integers. Take two inputs, one integer N and an array of integers. Loop through the array and count the occurrence of eac...read more
Anonymous
3y
Add answer anonymously...
Top Nagarro Senior Engineer interview questions & answers
Popular interview questions of Senior Engineer
Top HR questions asked in Nagarro Senior Engineer
Stay ahead in your career. Get AmbitionBox app
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+
Reviews
4 L+
Interviews
4 Cr+
Salaries
1 Cr+
Users/Month
Contribute to help millions
Get AmbitionBox app