Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Robot Sort by rodka81
def swapsort(array):
n = list(array)
swapped = True
swaps = []
while swapped:
swapped = False
for i in range(1, len(n)):
if n[i-1] > n[i]:
n[i-1], n[i] = n[i], n[i-1]
swaps.append(f"{i-1}{i}")
swapped = True
return ",".join(swaps)
Jan. 27, 2017