@@ -0,0 +1,631 @@
+/***%0A * Given a linked list, determine if it has a cycle in it.%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 */%0Apublic class Solution %7B%0A    public boolean hasCycle(ListNode head) %7B%0A        ListNode slow = head, fast = head;%0A        while (fast != null && fast.next != null) %7B%0A            slow = slow.next;%0A            fast = fast.next.next;%0A            if (slow == fast) return true;%0A        %7D%0A        return false;%0A    %7D%0A%7D%0A

add LinkedListCycle.java