Skip to content

Instantly share code, notes, and snippets.

@iwilbert
Created June 24, 2014 19:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iwilbert/e32064c46369092cba64 to your computer and use it in GitHub Desktop.
Save iwilbert/e32064c46369092cba64 to your computer and use it in GitHub Desktop.
public void deleteNode(ListNode node) {
// node is null or node is the last node
if(node == null || node.next == null)
return;
ListNode next = node.next;
node.val = next.val;
node.next = next.next;
next = null;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment