Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
pure iteration protocoll solution in Clear category for Swap Nodes by juestr
def swap_nodes(xs):
it = iter(xs)
try:
while True:
a = next(it)
try:
yield next(it)
finally:
yield a
except StopIteration:
pass
Nov. 1, 2019
Comments: