C# solution: copy the next node's value then remove the next node.


  • 0
    B
    public class Solution 
    {
        public void DeleteNode(ListNode node) 
    	{
            var cur = node;
    		cur.val = cur.next.val;
    		
    		var temp = cur.next.next;
    		cur.next.next = null;
    		cur.next = temp;
        }
    }
    

Log in to reply
 

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