var detectCycle = function(head) {if(!head)return null;let pre=head,cur=head;while(cur&&cur.next){pre=pre.next;cur=cur.next.next;if(pre===cur){let temp=head;while(temp!==pre){pre=pre.next;temp=temp.next;}return pre}}return null;
};
var detectCycle = function(head) {if(!head)return null;let pre=head,cur=head;while(cur&&cur.next){pre=pre.next;cur=cur.next.next;if(pre===cur){let temp=head;while(temp!==pre){pre=pre.next;temp=temp.next;}return pre}}return null;
};