Untitled
unknown
plain_text
2 years ago
319 B
6
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