You are viewing a single comment's thread. Return to all comments →
For some reason comments are blocked from @Isming's excellent solution posting here.
This is a python 3 translation of his C++ code:
def minimumBribes(q): bribes = 0 for i in range(len(q)-1,-1,-1): 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 →
For some reason comments are blocked from @Isming's excellent solution posting here.
This is a python 3 translation of his C++ code: