image_2021-11-14_00-07-22.png
30.1 KB
#N237. Delete Node in a Linked List
problem link
#solution
problem link
#solution
class Solution {
public void deleteNode(ListNode node) {
node.val=node.next.val;
node.next=node.next.next;
}
}
p.s.: but the question is totally wrong), because the head node is not given