题目:
题解:
func arrayNesting(nums []int) (ans int) {n := len(nums)for i := range nums {cnt := 0for nums[i] < n {i, nums[i] = nums[i], ncnt++}if cnt > ans {ans = cnt}}return
}
题目:
题解:
func arrayNesting(nums []int) (ans int) {n := len(nums)for i := range nums {cnt := 0for nums[i] < n {i, nums[i] = nums[i], ncnt++}if cnt > ans {ans = cnt}}return
}