Untitled

 avatar
unknown
plain_text
2 years ago
319 B
4
Indexable
class Solution:
    def middleNode(self, head: Optional[ListNode]) -> Optional[ListNode]:
        count = 0
        temp = head
        while temp:
            count += 1
            temp = temp.next

        current = head
        for i in range(count // 2):
            current = current.next

        return current
Editor is loading...
Leave a Comment