@@ -0,0 +1,1024 @@
+package main.algorithm.leetcode;%0A%0Aimport main.algorithm.leetcode.structure.ListNode;%0Aimport org.junit.Test;%0A%0A/**%0A * Description :%0A *   %3Ci%3Ehttps://leetcode.com/problems/delete-node-in-a-linked-list/%3C/i%3E%0A *   Runtime: 0 ms, faster than 100.00%25 of Java online submissions for Delete Node in a Linked List.%0A *   Memory Usage: 38.2 MB, less than 74.67%25 of Java online submissions for Delete Node in a Linked List.%0A *%0A * @author chile%0A * @version 1.0%0A * @date 2021/8/4 10:31%0A */%0Apublic class DeleteNodeInALinkedList %7B%0A%0A    class Solution %7B%0A%0A        public void deleteNode(ListNode node) %7B%0A            ListNode temp = node.next;%0A            node.val = node.next.val;%0A            node.next = node.next.next;%0A            temp = null;%0A        %7D%0A%0A    %7D%0A%0A    @Test%0A    public void test1() %7B%0A        ListNode head = new ListNode(1);%0A        head.addNext(2).addNext(3);%0A        new Solution().deleteNode(head.next);%0A        while (head != null) %7B%0A            System.out.println(head.val);%0A            head = head.next;%0A        %7D%0A    %7D%0A%0A%7D%0A

Delete Node in a Linked List