Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Gator And Ducks by tokiojapan55
def gator(ducks: int, step: int) -> list[int]:
order, result, i = list(range(ducks)), [], 0
while order:
i = (i + step - 1) % len(order)
result.append(order.pop(i))
return [result.index(i) + 1 for i in range(ducks)]
March 18, 2024