题目

delete-node-in-a-linked-list/


算法

* 直接模拟


代码

*直接模拟

class Solution {
public:
    void deleteNode(ListNode* node) {
        node->val = node->next->val;
        ListNode *tmp = node->next;
        node->next = tmp->next;
        delete tmp;
    }
};

results matching ""

    No results matching ""