Python - O(N) Time , O(1) Space
\nclass Solution:\n    def arrayNesting(self, nums):\n        result = 0\n        n = len(nums)\n        \n        for i in range(n):\n            curr = i\n   
```\nclass Solution:\n    def arrayNesting(self, nums):\n        result = 0\n        n = len(nums)\n        \n        for i in range(n):\n            curr = i\n            size = 0\n            \n            while not nums[curr] == -1:\n                size += 1\n                temp = nums[curr]\n                nums[curr] = -1\n                curr = temp\n            \n            result = max(result, size)\n        \n        return result\n```
[]