@@ -0,0 +1,719 @@
+// 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%0Apublic class Solution %7B%0A    public ListNode detectCycle(ListNode head) %7B%0A        if(head == null) return head;%0A%0A        ListNode fast = head;%0A        ListNode slow = head;%0A%0A        while(fast != null)%7B%0A        %09fast = fast.next;%0A        %09slow = slow.next;%0A%0A        %09if(fast != null)%7B%0A        %09%09fast = fast.next;%0A        %09%09if(fast == slow)%7B%0A        %09%09%09fast = head;%0A%0A        %09%09%09while(fast != slow)%7B%0A        %09%09%09%09fast = fast.next;%0A        %09%09%09%09slow = slow.next;%0A        %09%09%09%7D%0A%0A        %09%09%09return fast;%0A        %09%09%7D%0A        %09%7D%0A        %7D%0A%0A        return null;%0A    %7D%0A%7D

add likedlist cycle ii solution