Back

Given 2 numbers N and K followed by N elements,print the number of repetition of K otherwise print '-1' if the element not found. Sample Testcase : INPUT 6 2 1 2 3 5 7 8 OUTPUT 0

Created 2 years ago
424 Views
0 Comments
AjithKumar2Z1u9W
@AjithKumar2Z1u9W
AjithKumar2Z1u9W
@AjithKumar2Z1u9WProfile is locked. Login

ANS:

c,v=map(int,input().split())

numbers=list(map(int,input().split()))

count = numbers.count(v)

if count>1:

print(count)

elif count==1:

print(0)

else:

print(-1)

Comments
Please login to comment.