【leetcode刷題】19. Remove Nth Node From End of List

原題鏈接:https://leetcode.com/problems/remove-nth-node-from-end-of-list/ 解題思路:首先遍歷一次得到整個list的長度;然後再從頭開始計數,如果總長度爲total,要刪除倒數第n個,則該node與head的距離爲n,找到後刪除即可 代碼: class Solution(object): def removeNthFromEnd
相關文章
相關標籤/搜索