Skip to content

Commit

Permalink
Merge pull request soulmachine#47 from windpls/master
Browse files Browse the repository at this point in the history
fix a bug in "Remove Duplicates from Sorted List"
  • Loading branch information
soulmachine committed Jan 8, 2016
2 parents 564c00b + b0db464 commit 938534e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion C++/chapLinearList.tex
Original file line number Diff line number Diff line change
Expand Up @@ -2217,7 +2217,7 @@ \subsubsection{迭代版}
ListNode *deleteDuplicates(ListNode *head) {
if (head == nullptr) return nullptr;

for (ListNode *prev = head, *cur = head->next; cur; cur = cur->next) {
for (ListNode *prev = head, *cur = head->next; cur; cur = prev->next) {
if (prev->val == cur->val) {
prev->next = cur->next;
delete cur;
Expand Down

0 comments on commit 938534e

Please sign in to comment.