Skip to content

Commit 938534e

Browse files
committed
Merge pull request soulmachine#47 from windpls/master
fix a bug in "Remove Duplicates from Sorted List"
2 parents 564c00b + b0db464 commit 938534e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

C++/chapLinearList.tex

+1-1
Original file line numberDiff line numberDiff line change
@@ -2217,7 +2217,7 @@ \subsubsection{迭代版}
22172217
ListNode *deleteDuplicates(ListNode *head) {
22182218
if (head == nullptr) return nullptr;
22192219

2220-
for (ListNode *prev = head, *cur = head->next; cur; cur = cur->next) {
2220+
for (ListNode *prev = head, *cur = head->next; cur; cur = prev->next) {
22212221
if (prev->val == cur->val) {
22222222
prev->next = cur->next;
22232223
delete cur;

0 commit comments

Comments
 (0)