标签:链表 col 提交 code css append ret ext pen
# Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Solution: def middleNode(self, head: ListNode) -> ListNode: if head.next==None: return head r=[] while head: r.append(head.val) head=head.next r=r[len(r)//2:] head=ListNode(0) p=head for i in range(len(r)): p.next=ListNode(r[i]) p=p.next return head.next
标签:链表 col 提交 code css append ret ext pen
原文地址:https://www.cnblogs.com/taoyuxin/p/11731127.html