leetcode
-
[Leetcode] 565. Array Nesting array nestingAlgorithm/LeetCode 2021. 8. 12. 13:55
tags: LeetCode Algorithm Python A zero-indexed array A of length N contains all integers from 0 to N-1. Find and return the longest length of set S, where S[i] = {A[i], A[A[i]], A[A[A[i]]], ... } subjected to the rule below. Suppose the first element in S starts with the selection of element A[i] of index = i, the next element in S should be A[A[i]], and then A[A[A[i]]]… By that analogy, we stop..