Middle of a Linked List (LC-0876)
class Solution:
def middleNode(self, head):
fast = slow = head
while fast and fast.next:
fast = fast.next.next
slow = slow.next
return slow
class Solution:
def middleNode(self, head):
fast = slow = head
while fast and fast.next:
fast = fast.next.next
slow = slow.next
return slow