Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Scarecrow Robot by eugene100372
from collections import Counter
from itertools import accumulate
def visits(stations: int, control: int, commands: list[int]) -> int:
return Counter(accumulate(commands,
lambda total,x: (total+x-1)%stations+1,initial=1))[control]
March 6, 2025
Comments: