Skip to content

82 remove duplicates from sorted list 2#4

Open
kitano-kazuki wants to merge 3 commits intomainfrom
82-remove-duplicates-from-sorted-list-2
Open

82 remove duplicates from sorted list 2#4
kitano-kazuki wants to merge 3 commits intomainfrom
82-remove-duplicates-from-sorted-list-2

Conversation

@kitano-kazuki
Copy link
Owner

* 基準点の一個先(一つ目のポインタの二個先)が基準点と同じ値である限り前に進める.
* 基準点と違う値になった場所(あるいはNoneになった場所)が, 一つ目のポインタのnextが指すノード(=A)になる.
* 仕事の引き継ぎ
* 一つ目のポインタをAに移す.
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

これは不適.
一つ目のポインタのnextをAに変えるが正しい

dummy_head = ListNode()
dummy_head.next = head
unique = dummy_head
while unique.next:
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

手癖でis not Noneにするのを忘れていた

## Code2-1

* `processed_end`を`unique`にした.
* 他の人を見る限り`dummy`は結局使わないと難しそう.
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

headの性質で分岐させればいける
yus-yus/leetcode#4 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant