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.
defminimumBribes(q):# Write your code heretotal_steps=0n=len(q)foriinrange(n):# Check if the element has moved more than two positions forwardifq[i]-(i+1)>2:returnprint("Too chaotic")forjinrange(max(0,q[i]-2),i):ifq[j]>q[i]:total_steps+=1returnprint(total_steps)
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
New Year Chaos
You are viewing a single comment's thread. Return to all comments →
pyhton 3