class Solution:
def removeNthFromEnd(self, head: ListNode, n: int) -> ListNode:
Head = ListNode(0)
Head.next = head
fast = Head
for _ in range(n+1):
fast = fast.next
slow = Head
while fast:
fast = fast.next
slow = slow.next
#此时slow指向倒数第n+1
slow.next = slow.next.next #删去倒数第n个
return Head.next