我使用的利用哈希表来判断入口结点
没有达到LeetCode上进阶的要求,
public ListNode detectCycle(ListNode head) {
if(head==null){
return null;
}
if(head.next==null){
return null;
}
ListNode slow=head;
ListNode fast=head.next;
while(slow!=fast){
slow=slow.next;
fast=fast.next.next;
}
}