237.delete-node-in-a-linked-list.js 323 B

123456789101112131415
  1. /**
  2. * Definition for singly-linked list.
  3. * function ListNode(val) {
  4. * this.val = val;
  5. * this.next = null;
  6. * }
  7. */
  8. /**
  9. * @param {ListNode} node
  10. * @return {void} Do not return anything, modify node in-place instead.
  11. */
  12. var deleteNode = function(node) {
  13. node.val = node.next.val
  14. node.next = node.next.next
  15. }