题目
Leetcode官方 way
1 | /** |
Reference
https://leetcode-cn.com/problems/delete-node-in-a-linked-list/solution/shan-chu-lian-biao-zhong-de-jie-dian-by-leetcode/
总结
- 提供了一个新的删除节点的思路:
- 在不考虑末尾节点的时候!!
- 跟下一个节点交换值之后,然后调整
next
指针为next->next
Just a Blog
1 | /** |
https://leetcode-cn.com/problems/delete-node-in-a-linked-list/solution/shan-chu-lian-biao-zhong-de-jie-dian-by-leetcode/
next
指针为next->next