Anonymous user
Best shuffle: Difference between revisions
→Swap if it is locally better algorithm: while loop not needed.
m (→Swap if it is locally better algorithm: fouled up 'a') |
(→Swap if it is locally better algorithm: while loop not needed.) |
||
Line 1,221:
n = len(w)
rangelists = (list(range(n)), list(range(n)))
for r in
rangei, rangej
▲ for i in rangei:
▲ if i != j and w2[j] != w2[i] and w[i] != w2[j] and w[j] != w2[i]:
w2 = ''.join(w2)
return w2, count(w, w2)
|