Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
sum tuple zip solution in Clear category for Swap Nodes by kdim
def swap_nodes(a):
return sum(tuple(zip(a[1::2], a[::2])), ()) + tuple(a[-1:] * (len(a) % 2))
Feb. 27, 2021