public class Solution {
public int FindDuplicate(int[] nums) {
if (nums.Count() > )
{
int slow = nums[];
int fast = nums[nums[]];
while (slow != fast)
{
slow = nums[slow];
fast = nums[nums[fast]];
} fast = ;
while (fast != slow)
{
fast = nums[fast];
slow = nums[slow];
}
return slow;
}
return -;
}
}

https://leetcode.com/problems/find-the-duplicate-number/#/description

05-12 08:19