标签:lse 直接 表示 val user 时间 turn else head
解题思路
public ListNode deleteNode(ListNode head,ListNode tobeDelete) { if(head == null || tobeDelete == null) { return null; } if(tobeDelete.next != null) { //要删除的节点不是尾结点 ListNode next = tobeDelete.next; tobeDelete.val = next.val; tobeDelete.next = next.next; }else{ if(head == tobeDelete) { head = null; } else { ListNode cur = head; while(cur.next != null) { cur = cur.next; } cur.next = null; } } return head; }
标签:lse 直接 表示 val user 时间 turn else head
原文地址:https://www.cnblogs.com/ziytong/p/12114739.html