https://leetcode-cn.com/problems/middle-of-the-linked-list/
class Solution: def middleNode(self, head: ListNode) -> ListNode: Head = ListNode(None) Head.next = head slow = fast = Head while fast.next and fast.next.next: fast = fast.next.next slow = slow.next return slow.next
最后更新于5年前