Longest Cycle in a Graph
Each node has at most one outgoing edge, given by edges[i] (-1 for none). Print the length of the longest cycle, or -1 if there is none.
Constraints
2 <= n <= 10^5
Discussion
No discussions yet.
Shalyam Support
Hi! Ask us anything — we'll reply on WhatsApp or Telegram within 24 hours.