@@ -0,0 +1,963 @@
+/***%0A * Given a linked list, return the node where the cycle begins. If there is no cycle, return null.%0A *%0A * Follow up:%0A * Can you solve it without using extra space?%0A */%0A/**%0A  * Definition for singly-linked list.%0A  * class ListNode %7B%0A  *     int val;%0A  *     ListNode next;%0A  *     ListNode(int x) %7B%0A  *         val = x;%0A  *         next = null;%0A  *     %7D%0A  * %7D%0A  */%0A//  (------x------%7C--a--M---%7C) : Total Length L, M is meet point%0A//  x = (n - 1)r + (L - x - a)%0Apublic class Solution %7B%0A    public ListNode detectCycle(ListNode head) %7B%0A        ListNode fast = head, slow = head, slow2 = head;%0A        while (fast != null && fast.next != null) %7B%0A            slow = slow.next;%0A            fast = fast.next.next;%0A            if (slow == fast) %7B%0A                while (slow != slow2) %7B%0A                    slow = slow.next;%0A                    slow2 = slow2.next;%0A                %7D%0A                return slow2;%0A            %7D%0A        %7D%0A        return null;%0A    %7D%0A%7D%0A

add LinkedListCycleII.java