I, entitled
Second, the idea
Third, the code
public class T0237 {
public static void main(String[] args) {
}
public void deleteNode(ListNode node) {
node.val = node.next.val;
node.next = node.next.next;
}
}
class ListNode {
int val;
ListNode next;
ListNode(int x) {
val = x;
}
}
Source: stay button (LeetCode)
link: https: //leetcode-cn.com/problems/delete-node-in-a-linked-list
copyrighted by deduction from all networks. Commercial reprint please contact the authorized official, non-commercial reprint please indicate the source. ↩︎