# Leetcode 19. Remove Nth Node From End of List
給定一個鏈結串列,以及一個數字n,刪除從串列尾端算來第n個節點。
## 想法
### 類似暴力解
先計算串列長度,則可知道從後面數來第n個節點,從前面數來為第幾個,再拿掉此節點。
程式碼:
```
def removeNthFromEnd(self, head: ListNode, n: int) -> ListNode:
first = head
length = 0
while(first):
length+=1
first = first.next
n =length - n
first = head
if(n==0):
return head.next
else:
while(n>1):
first = first.next
n-=1
first.next = first.next.next
return head
```