comefrom: <doocs>0565.Array Nesting_1.py
code: def arrayNesting( nums: List[int]) -> int:
      ans, n = 0, len(nums)
      for i in range(n):
          cnt = 0
          while nums[i] != n:
              j = nums[i]
              nums[i] = n
              i = j
              cnt += 1
          ans = max(ans, cnt)
      return ans
masked: def sample_funcname ( var_0 : List [ int ] ) -> int :
      var_4 , var_6 = 0 , len ( var_0 )
      for var_8 in range ( var_6 ) :
          var_9 = 0
          while var_0 [ var_8 ] != var_6 :
              var_10 = var_0 [ var_8 ]
              var_0 [ var_8 ] = var_6
              var_8 = var_10
              var_9 += 1
          var_4 = max ( var_4 , var_9 )
      return var_4
  