private boolean slowAndFastSolution(ListNode head) { if (head == null) { return false; } ListNode slow = head; ListNode fast = head.next; while (fast != null && fast.next != null) { if (slow.equals(fast)) { return true; } slow = slow.next; fast = fast.next.next; } return false; }