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_1 , var_2 = 0 , len ( var_0 )
      for var_3 in range ( var_2 ) :
          var_4 = 0
          while var_0 [ var_3 ] != var_2 :
              var_5 = var_0 [ var_3 ]
              var_0 [ var_3 ] = var_2
              var_3 = var_5
              var_4 += 1
          var_1 = max ( var_1 , var_4 )
      return var_1
  