3
0
热心网友
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; };
使用道具 举报
本版积分规则 发表回复 回帖并转播 回帖后跳转到最后一页
圆梦公社,专注于为全球华人提供纯粹技术交流的地方,请勿发布任何政治及违法的言论。如有相关侵权、举报、投诉及建议等,请发 E-mail:dzh188@hotmail.com
Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.