@@ -0,0 +1,1259 @@
+public class Solution %7B%0A    public int findDuplicate(int%5B%5D nums) %7B%0A        return binarySearch(nums);%0A    %7D%0A%0A    private int binarySearch(int%5B%5D nums) %7B%0A        int low = 1;%0A        int high = nums.length;%0A%0A        while (low %3C high) %7B%0A            int mid = (low + high) / 2;%0A            int count = 0;%0A            for (int n : nums) %7B%0A                if (low %3C= n && n %3C= mid) count++;%0A            %7D%0A            if (count %3E (mid - low + 1)) %7B%0A                high = mid;%0A            %7D else %7B%0A                low = mid + 1;%0A            %7D%0A        %7D%0A        return low;%0A    %7D%0A    // not completed%0A    private int hareTor(int%5B%5D nums) %7B%0A        int n = nums.length;%0A        int tor = nums%5B0%5D;%0A        int hare = nums%5B0%5D;%0A%0A        do %7B%0A            tor = move(nums, tor);%0A            hare = move(nums, move(nums, hare));%0A        %7D while (tor != hare);%0A        tor = nums%5B0%5D;%0A        while (tor != hare) %7B%0A            tor = move(nums, tor);%0A            hare = move(nums, hare);%0A        %7D%0A        return tor;%0A    %7D%0A%0A    private int move(int%5B%5D nums, int current) %7B%0A        if (nums%5Bcurrent-1%5D == current) %7B%0A            current = (current %25 nums.length) + 1;%0A            return move(nums, current);%0A        %7D else %7B%0A            return nums%5Bcurrent-1%5D;%0A        %7D%0A    %7D%0A%7D%0A

287. Find the Duplicate Number