Skip to content

Instantly share code, notes, and snippets.

@Irene-123
Created January 9, 2021 02:24
Show Gist options
  • Save Irene-123/39e6710cffc1d97b3d6694de8916593e to your computer and use it in GitHub Desktop.
Save Irene-123/39e6710cffc1d97b3d6694de8916593e to your computer and use it in GitHub Desktop.
MOnk and search //Error filled
n=int(input())
arr=list(map(int,input().split()))[:n]
arr.sort
q=int(input())
ques=[input().split() for i in range(q)]
for que in ques:
count=0
if que[0]=='0':
for i in range(n-1,-1,-1):
if arr[i]< int(que[1]):
break
count+=1
print(count)
else:
for i in range(n-1,-1,-1):
if arr[i]<= int(que[1]):
break
count+=1
print(count)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment