a=list(map(int,input().split()))
x=int(input())
if a[len(a)//2]==x:
print("Yes")
else:
print("NO")
Method-2
def find(a,x):
l=len(a)
if l%2==0:
ind=(l//2)+1
else:
ind=l//2
for i in range(ind):
if a[i]==x and a[i+l//2]==x:
return 1
a=list(map(int,input().split()))
x=int(input())
if find(a,x):
print("Yes")
Input:
1 2 3 3 3 3 4 5
3
Output
Yes
No comments:
Post a Comment