mirror of
https://github.com/CyC2018/Interview-Notebook.git
synced 2026-10-24 18:23:43 +00:00
Update 18.1 在 O(1) 时间内删除链表节点.md
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5
parent
e959de0364
commit
2b56a2277f
@@ -15,7 +15,7 @@
|
||||
```java
|
||||
public ListNode deleteNode(ListNode head, ListNode tobeDelete) {
|
||||
if (head == null || tobeDelete == null)
|
||||
return null;
|
||||
return head;
|
||||
if (tobeDelete.next != null) {
|
||||
// 要删除的节点不是尾节点
|
||||
ListNode next = tobeDelete.next;
|
||||
|
||||
Reference in New Issue
Block a user