Count Cycles in a Permutation
Print the number of cycles in a permutation p of 1..n (follow i -> p[i]).
Constraints
1 <= n <= 10^5
Discussion
No discussions yet.
Shalyam Support
Hi! Ask us anything — we'll reply on WhatsApp or Telegram within 24 hours.