class Solution:
def GetNumberOfK(self, data, k):
l = 0
r = len(data)-1
while l <= r:
m = l + (r - l)//2
if data[m] > k:
r = m - 1
elif data[m] < k:
l = m + 1
else:
l = m + 1
right = l
l = 0
while l <= r:
m = l + (r - l)//2
if data[m] < k:
l = m + 1
else:
r = m - 1
return right - r - 1
class Solution:
def GetNumberOfK(self, data, k):
# write code here
count = 0
for i in range(len(data)):
if data[i] == k:
count +=1
return count