get majority element from array