Python2.x [EASY] [DICTIONARY]


#1
class Solution:
    # @param A : tuple of integers
    # @return an integer
    def repeatedNumber(self, A):
        threshold = len(A)//3
        d = dict()
        for i in A :
            if i not in d :
                d[i] = 1
            else :
                d[i] += 1
            if d[i] > threshold :
                return i
        return -1

#2

yeah…python bouys…XD XD…problem specifically mentions that it should be solved in constant space…XD XD