8000 fix a bug in "Remove Duplicates from Sorted List" · qdl159/leetcode@b0db464 · GitHub
[go: up one dir, main page]

Skip to content

Commit b0db464

Browse files
committed
fix a bug in "Remove Duplicates from Sorted List"
1 parent 3c0b4e6 commit b0db464

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

C++/chapLinearList.tex

Lines changed: 1 addition & 1 deletion
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 388E cur;

0 commit comments

Comments
 (0)
0