237. Delete Node in a Linked List - cocoder39/coco39_LC GitHub Wiki

237. Delete Node in a Linked List

for both solutions, the precondition is node is not the tail

void deleteNode(ListNode* node) {
        *node = *(node->next); 
    }
void deleteNode(ListNode* node) {
        node->val = node->next->val;
        node->next = node->next->next;
    }