We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see ourdocumentation.
There was an error while loading.Please reload this page.
原题链接
老套路,借助快慢指针,fast 一次走两步,slow 一次走一步,当 fast 到达链表末尾时,slow 就处于链表的中间点了。
constmiddleNode=function(head){letfast=head,slow=head;while(fast&&fast.next){slow=slow.next;fast=fast.next.next;}returnslow;};