Easy understand Python code
\nclass Solution(object):\n    def arrayNesting(self, nums):\n        """\n        :type nums: List[int]\n        :rtype: int\n        """\n        dic = {}\n  
```\nclass Solution(object):\n    def arrayNesting(self, nums):\n        """\n        :type nums: List[int]\n        :rtype: int\n        """\n        dic = {}\n        result = -float('inf')\n        for index in range(len(nums)):\n            count = 1\n            dic[index] = 1\n            while True:\n                if nums[index] not in dic:\n                    count += 1\n                    dic[nums[index]] = 1\n                    index = nums[index]\n                else:\n                    result = max(result,count)\n                    break\n        return result\n```
[]