Search
⌘K

Leetcode 565. Array Nesting

Given a permutation nums of 0..n-1, repeatedly follow the mapping i -> nums[i] from each start index until a value repeats and form a set; return the maximum size of any such set — equivalently, the length of the largest cycle in the permutation (n up to 10^5).


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.