Given an array of size n, which contains duplicate elements. Find and return the majority element which occurs more than n/2 times in the array.
Note : Return -1 if no majority element is present.
Input format :
Line 1 : Size of input array
Line 2 : Array elements (separated by space)
Sample Input 1 :
5 2 1 1 2 1
Sample Output 1 :
Login to submit your solution