s4553711
4/4/2017 - 2:14 PM

237.cpp

/**
 * Definition for singly-linked list.
 * struct ListNode {
 *     int val;
 *     ListNode *next;
 *     ListNode(int x) : val(x), next(NULL) {}
 * };
 */
class Solution {
public:
    void deleteNode(ListNode* node) {
        if (node == NULL) { 
        } else {
            ListNode* t = node->next;
            node->val = t->val;
            node->next = t->next;
            delete t;
        }
    }
};