141.Linked List Cycle Posted on 2017-10-12 | In LeetCode Solution 1: acceptedThe use of dummy is optional. If we do fast = head, we need to verify that head != null. 1234567891011121314public boolean hasCycle(ListNode head) { ListNode dummy = new ListNode(1); dummy.next = head; ListNode fast = dummy; ListNode slow = dummy; while (fast.next != null && fast.next.next != null) { fast = fast.next.next; slow = slow.next; if (fast == slow) { return true; } } return false;}