We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
def larrysArray(A):
# Write your code here
c=0
for i in range(0,len(A)-1):
for j in range(i,len(A)):
if(A[i]>A[j]):
c+=1
if(c%2==0):
return "YES"
else:
return "NO"
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Larry's Array
You are viewing a single comment's thread. Return to all comments →
Using Python :
def larrysArray(A): # Write your code here c=0 for i in range(0,len(A)-1): for j in range(i,len(A)): if(A[i]>A[j]): c+=1 if(c%2==0): return "YES" else: return "NO"