Skip to content

82. Remove Duplicates from Sorted List II.md #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

lilnoahhh
Copy link
Owner

82. Remove Duplicates from Sorted List II

Given the head of a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list. Return the linked list sorted as well.

次は2. Add Two Numbers

(https://github.com/olsen-blue/Arai60/pull/4)

araiさんや他の人のgitを見るとdummyで書いていたが、sentinelは有名な呼び方じゃないのかな。
sentinelで書こうと思ったがdummyという変数名で書くことにする。
Copy link

Choose a reason for hiding this comment

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

これはどちらでもいいでしょう。

もう少し書き方のオプションや何を引き継ぐ約束でループを回しているのかについて、考えるために下のドキュメントを貼っておきます。どこまで掘り下げるかはオプショナルです。
https://docs.google.com/document/d/11HV35ADPo9QxJOpJQ24FcZvtvioli770WWdZZDaLOfg/edit?tab=t.0#heading=h.xzxd7jwvkwc5

node = head

while node is not None and node.next is not None:

Copy link

Choose a reason for hiding this comment

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

while 文の直後に空行を入れるのはあまり見ないかもしれません。好みの問題かもしれません。

last_fixed_node = last_fixed_node.next

node = node.next

Copy link

Choose a reason for hiding this comment

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

関数内で空行を入れる際は 1 行のみとするのが良いと思います。

https://google.github.io/styleguide/pyguide.html#35-blank-lines

Use single blank lines as you judge appropriate within functions or methods.

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.

3 participants