19. Remove Nth Node From End of List
1.問題
給予一個list, 刪除倒數第n個node
2.想法
1.用traversal計算list有多長
2.刪除node
需要兩個node: current, previous,分別指向目標及目標的前一個node
將current移動到目標
刪除node
3.程式碼
4.Performance
Last updated
給予一個list, 刪除倒數第n個node
1.用traversal計算list有多長
2.刪除node
需要兩個node: current, previous,分別指向目標及目標的前一個node
將current移動到目標
刪除node
Last updated