We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
原题链接
老套路,借助快慢指针,fast 一次走两步,slow 一次走一步,当 fast 到达链表末尾时,slow 就处于链表的中间点了。
const middleNode = function(head) { let fast = head, slow = head; while (fast && fast.next) { slow = slow.next; fast = fast.next.next; } return slow; };
The text was updated successfully, but these errors were encountered:
No branches or pull requests
原题链接
快慢指针
老套路,借助快慢指针,fast 一次走两步,slow 一次走一步,当 fast 到达链表末尾时,slow 就处于链表的中间点了。
The text was updated successfully, but these errors were encountered: