Solution (source code)

= Solution

For each $j\ne0$, cut the cycle at $j$. The event that $j$ is last is the event that the lifted walk covers the other $n-1$ residues before crossing that cut. Gambler’s ruin (or cyclic symmetry of the two expanding endpoints) gives $\mathbb P(Z=j)=1/(n-1)$.