Have to make sure the pointer is not null, and its next is not null before assigning the pointer, e.g. fast = fast.null
hasCycleTwoPointers2() optimize the while condition.
Remember
if ListNode ln = new ListNode(3), then ln.next == null. The next pointer is always exists. So we don’t need to check ln.next != null if we assign fast = ln.next;