-
Notifications
You must be signed in to change notification settings - Fork 0
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
base: main
Are you sure you want to change the base?
Conversation
(https://github.com/olsen-blue/Arai60/pull/4) | ||
|
||
araiさんや他の人のgitを見るとdummyで書いていたが、sentinelは有名な呼び方じゃないのかな。 | ||
sentinelで書こうと思ったがdummyという変数名で書くことにする。 |
There was a problem hiding this comment.
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: | ||
|
There was a problem hiding this comment.
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 | ||
|
There was a problem hiding this comment.
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.
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