list_node * remove_rep(list_node * head) { //////在下面完成代码 if(head == nullptr || head->next == nullptr) return head; map<int,int> Map; list_node* cur = head; Map[cur->val]++; while(cur->next != nullptr) { if(++Map[cur->next->val] > 1) { Map[cur->next->val] = 1; cur->next = cur->next->next; } else cur = cur->next; } return head; }