Python - DFS
\nclass Solution:\n    def arrayNesting(self, nums: List[int]) -> int:\n        \n        def DFS(nums, i, l):\n            if nums[i] == -1:\n                r
```\nclass Solution:\n    def arrayNesting(self, nums: List[int]) -> int:\n        \n        def DFS(nums, i, l):\n            if nums[i] == -1:\n                return l\n            nums[i], i = -1, nums[i]\n            \n            return DFS(nums, i, l+1)\n        \n        m = 0\n        for i in range(len(nums)):\n            l = 0\n            if nums[i] == -1: continue\n            \n            l = DFS(nums, i, l)\n            m = max(m, l)\n        \n        return m\n```
[]