Problem 3425 · Hard

Longest Special Path

Walk outward from every node, stopping as soon as a value repeats; a special path keeps the longest length, then the fewest nodes.

Open the interactive visualisation