You are viewing a single comment's thread. Return to all comments →
Here is the Simple and Sweet solution
def minimumBribes(q): # Write your code here bribes = 0 for i in range(len(q)): if q[i] - (i + 1) > 2: print("Too chaotic") return for j in range(max(0, q[i] - 2), i): if q[j] > q[i]: bribes += 1 print(bribes)
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 →
Here is the Simple and Sweet solution