My simple java solution


  • -3
    C
    public class Solution {
        public void deleteNode(ListNode node) {
            while(node.next.next != null) {
                node.val = node.next.val;
                node = node.next;
            }
            node.val = node.next.val;
            node.next = null;
        }
    }

Log in to reply
 

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