题解 | #删除链表的节点#
删除链表的节点
https://www.nowcoder.com/practice/f9f78ca89ad643c99701a7142bd59f5d
class Solution: def deleteNode(self , head: ListNode, val: int) -> ListNode: # write code here if head.val == val: head = head.next else: pre = head now = head while now: if now.val == val: pre.next = now.next break pre = now now = now.next return head