Very Easy Python Solution using collections library


#1
def majorityElement(self, A):
    s = len(A)/2
    count = collections.Counter(A)
    for i in range(len(A)):
        if count[A[i]] > s:
            return A[i]