```
ListNode *deleteDuplicates(ListNode *head) {
ListNode* cur=head;
while (cur){
while(cur->next ){
if (cur->val==cur->next->val)
cur->next=cur->next->next;
}
cur=cur->next;
}
return head;
}
```

Is the code above equivalent to the accepted answer below?

```
ListNode *deleteDuplicates(ListNode *head) {
ListNode* cur=head;
while (cur){
while(cur->next && cur->val==cur->next->val){
//if (cur->val==cur->next->val){
cur->next=cur->next->next;
//}
}
cur=cur->next;
}
return head;
}
```

Any feedback is greatly appreciated!