Java solution. Set value as value of next node, then set pointer to next nodes pointer.


  • 0
    Q
    public class Solution {
        public void deleteNode(ListNode node) {
            node.val = node.next.val;
            node.next=node.next.next;
        }
    }

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.