Untitled

Anonymous
plain_text
12/18/2023 9:16 AM
428 B
17
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