Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Simple solution in Clear category for Swap Nodes by suic
def swap_nodes(lst):
r, l = lst[:], len(lst)
for i in range(0, l-1 - (l%2), 2):
r[i:i+2] = r[i:i+2][::-1]
return r
Jan. 26, 2019