【leetcode】移除重复节点

struct ListNode* removeDuplicateNodes(struct ListNode* head){
    int hash[20001] = {0};
    struct ListNode* node = head;
    struct ListNode* pre = NULL;
    while(node)
    {
        if (!hash[node->val])
        {
            hash[node->val]++;
        }
        else
        {
            pre->next = node->next;
            node = node->next;
            continue;
        }
        pre = node;
        node = node->next;
    }
    return head;
}
原文地址:https://www.cnblogs.com/ganxiang/p/13637846.html