【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;
}