Python 3 | Array, Clean O(N) | Explanation
Explanation\n- First, you need to understand all numbers in nums are unique\n- Given that, you can basically travel to the next number until you hit a cycle\n- 
### Explanation\n- First, you need to understand all numbers in `nums` are unique\n- Given that, you can basically travel to the next number until you hit a cycle\n- Record the length during the run\n- Set visited value to `-1` to avoid revisit\n### Implementation\n```\nclass Solution:\n    def arrayNesting(self, nums: List[int]) -> int:\n        ans = cnt = 0\n        for i, idx in enumerate(nums):\n            if idx < 0: continue                           # avoid revisit\n            while nums[idx] >= 0:\n                cnt, nums[idx], idx = cnt+1, -1, nums[idx] # increment length; mark as visited; visit next value\n            else:    \n                ans, cnt = max(ans, cnt), 0                # record length and reset `cnt`\n        return ans\n```
['Array', 'Python', 'Python3']