You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
这里第二次调用是多余的!
duplicate 中每一次for循环的目的都是为了让 nums[i] == i ,也就是第 i 个位置等于 i 。
所以 while 循环要么找到重复数字return,要么结束循环后使得 nums[i] == i ,这时候再调用 swap(nums, i, nums[i]) 没有任何意义