Python easy and understanding solution


#1
class Solution:
    # @param A : tuple of integers
    # @param B : integer
    # @return an integer
    def findCount(self, A, B):
        a=list(A)
        x=0
        for i in range(len(a)):
            if B==a[i]:
               x+=1
              
        if x==0:
            return 0
        else:
            return x

#2

But this is O(n). We need O(log n)