Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Follow Ghost Legs by kazuki.h
def follow_ghost_legs(n, legs):
result = [i for i in range(n+1)]
for i, j in legs:
result[i], result[j] = result[j], result[i]
return [result[i+1] for i in range(n)]
April 11, 2025
Comments: