Skip to content

Instantly share code, notes, and snippets.

On vacation

Callum Mann cmanny

On vacation
Block or report user

Report or block cmanny

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
def count_swaps(nums):
swaps = 0
nn = [x for x in nums]
l = len(nn)
for i, j in zip(range(l - 2, -1, -1), range(l - 1, 0, -1)) * l:
if nn[i] > nn[j]:
nn[j], nn[i] = nn[i], nn[j]
swaps += 1
return swaps
You can’t perform that action at this time.